In this doc, we'll show how to import data from your local qri repository into a Jupyter notebook for analysis.
You can also do the dataset
pull from your python code. Read on!
Qri's python client
qri-python is available on pip.
$ pip install qri
You can quickly pull any dataset from Qri Cloud by running a cell with
This line will pull the popular COVID-19 Data Repository by the Center for Systems Science and Engineering (CSSE) at Johns Hopkins University, which has been published and kept up-to-date on qri.cloud by user @xristosk
If you are new to Qri, each dataset is made up of components, and the one with all of the data in it is called the
body. This is what we’re going to want to work with inside of a Jupyter Notebook. When you use
qri.get(), qri-python grabs the body of a dataset and turns it into something familiar in the data science world: a Pandas DataFrame.
df = qri.get("xristosk/aug_daily_covid19_jh").bodydf.head()
Sometimes we might not need all of the data in the body of a dataset; maybe we just need a chunk of it, or maybe you’re someone who is more familiar with SQL than they are with Pandas. Qri-Python has a
sql() method to help out with that. In this example, we want to select only cases in Italy.
query = """SELECT *FROM xristosk/aug_daily_covid19_jh AS augWHERE aug.country_region = 'Italy'"""df = qri.sql(query)df.head()
qri-python, you can use datasets from Qri Cloud directly inside of a Jupyter Notebook. It’s a quick way to fetch data you need and jump right into your analysis and visualizations.