Skip to content

requesting API with multiple columns #5

@TurtleJelly

Description

@TurtleJelly

Hi Team Glassnode,

When retrieving API with multiple columns, the column name is 'o' not 'v'.

(e.g : https://api.glassnode.com/v1/metrics/supply/hodl_waves)

And it cannot be retrieved properly with current API connector.

I have added below code to fix the problem, but the iterator make the whole process quite slow...

try:
    df = pd.DataFrame(json.loads(r.text))
    df = df.set_index('t')
    df.index = pd.to_datetime(df.index, unit='s')
    df = df.sort_index()
    s = pd.DataFrame()
    for r, c in df.iterrows():
        for k, v in c['o'].items():
            s.loc[r, k] = v
    return s

except Exception as e:
    print(e)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions