Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.
This repository was archived by the owner on Aug 15, 2023. It is now read-only.

Improvement: Parse grouped by dates automatically #39

@timo-at-lanalabs

Description

@timo-at-lanalabs

Currently the data that arrives from a request like this:

df = api.aggregate(log_id, metric="frequency", grouping="byMonth",  
                   date_type="startDate", max_amount_attributes=10000)

is ordered by the frequency. The grouped by column is returned as string and not natively recognized by python. The quarterly string needs parsing. Ideally we centralise this function in PyLana.

if "byQuarter" in df.columns:
    df['x_axes'] = pd.to_datetime(
        df['byQuarter'].str.replace(r'(Q\d) (\d+)', r'\2-\1'), errors='coerce')
elif "byYear" in df.columns:
    df["x_axes"] = pd.to_datetime(df.byYear)
elif "byMonth" in df.columns:
    df["x_axes"] = pd.to_datetime(df.byMonth)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions