Loading Data Files in Python
Supported Formats
Python can load the following data file formats:
Compressed CSV (
.csv.gz
)ORC (
.orc
)Parquet (
.parquet
)
Download the Data Files
Download and save the data files to a suitable location. In the examples that follow, the data has been saved to C:\data
.
Although you could load data files directly from the data file URLs, this is not recommended because you may quickly hit usage limits or incur additional costs. We always recommend saving the files locally or to cloud storage first using the Open Data Blend Dataset UI, Open Data Blend Dataset API, or Open Data Blend for Python.
Loading Compressed (Gzip) CSV Data Files
You can use the below steps as a guide on how you can load compressed (Gzip) data files into Python.
Install the pandas
module from the Anaconda prompt.
Import the pandas
module.
Read the compressed CSV data file into a data frame.
Loading ORC Data Files
You can use the below steps as a guide on how you can load ORC data files into Python.
There was a known issue with the pyarrow.orc
module, which prevented it from working correctly. If you experience the same issue, try upgrading the module to a newer version that includes the fix.
Install pandas
and the last version of pyarrow
modules.
Import the pandas
and pyarrow
modules.
Read the ORC data file into a data frame.
Read a subset of the columns from the Parquet data file into a data frame.
Loading Parquet Data Files
You can use the below steps as a guide on how you can load Parquet data files in Python.
Install the Pandas and Apache Arrow modules.
Import the Pandas and Apache Arrow modules.
Read the Parquet data file into a data frame.
Read a subset of the columns from the Parquet data file into a data frame.
When working with larger data files, it is a good practice to only read the required columns because it will reduce the read times, memory footprint, and processing times.
Open Data Blend for Python
Open Data Blend for Python is the recommended method for ingesting Open Data Blend datasets using Python. You can use the Python package called opendatablend
to quickly copy data files and the corresponding dataset metadata to your local machine or supported data lake storage.
Install the opendatablend module.
Get the data.
Use the data.
You can learn more about Open Data Blend for Python including how to use it to ingest data into supported data lakes here.
Using Python for Data Analysis
Guidance on how to analyse data in Python is beyond the scope of this documentation.
You may find the following helpful:
Pandas documentation (suitable for small to medium-sized data files)
Mondin documentation (suitable for data of any size, especially very large data files)
Pandas API on Spark documentation (suitable for data of any size, especially very large data files)
Last updated