ChainArgos
API
API
  • 🔌api-demos
  • Basic google-sheet-pivot-table-based gueries
    • 🦮API walkthrough
    • 🎬Basic ETL demo
    • 🎰Compute statistics on YGG flows
  • More complex Looker API queries
    • Looker API introduction
    • Downloading a look to pandas
    • Ethereum address inflows
    • Running a look via API
    • Running a look with several filters via API
  • Research
    • How empty are Heco blocks these days?
    • Tether minting vs BTC price
    • Wallet evaluation
Powered by GitBook
On this page
  1. More complex Looker API queries

Downloading a look to pandas

PreviousLooker API introductionNextEthereum address inflows

Last updated 1 year ago

This example downloads data from a look to a pandas dataframe.

Here we just run the query as-is. In the next example we will see how to modify the filters on the query.

https://github.com/ChainArgos/api-demos/blob/main/looker/look_to_pandas/look_to_pandas.py
from io import StringIO
import looker_sdk
import pandas as pd

# This is the look we are going to run.
# You can get this from the URL (i.e. https://dashargos.chainargos.com/looks/722 -> 722)
LOOK_ID=722

# initialize connection
sdk = looker_sdk.init40("../looker.ini")

# run look with csv results
look_results = sdk.run_look(look_id=str(LOOK_ID), result_format="csv")

# csv to pandas
df = pd.read_csv(StringIO(look_results))

# print it out
print(str(df))