Reading Parquet Data

The NYC taxi dataset used in the training lesson moved from CSV to Parquet. Parquet files are smaller and preserve column types, but we need a Parquet engine before pandas can read them.

Download the files

Download the January and February files into the data directory:

wget https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2021-01.parquet
wget https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2021-02.parquet

The two NYC taxi Parquet files downloading in the terminal

Install a Parquet engine

Install pyarrow or fastparquet so pandas can read Parquet files.

In the notebook, use pyarrow with this command:

!pip install pyarrow

Without pyarrow or fastparquet, pandas.read_parquet reports that it can't find a usable engine.

The pandas error explaining that a Parquet engine is missing

Read the data

Read the file with read_parquet instead of read_csv:

import pandas as pd

df = pd.read_parquet('data/green_tripdata_2021-01.parquet')

Parquet already stores the pickup and drop-off timestamps with datetime information. The later training notebook doesn't need the same string-parsing step used by the older CSV version.

The notebook reading Parquet data and calculating ride duration

Optional analytics

Optional analytics are off unless you allow them. Your choice does not affect access to DataTalks.Club, Slack, events, or courses.

Current choice: not chosen.

Privacy Policy

If you allow analytics, self-hosted Umami counts anonymous public pageviews without analytics cookies. Private account and learning pages are excluded. Read the Privacy Policy for the complete data boundary.