Load a CSV file in Python
CSV (Comma Separated Values) is a widely used format for logging flight, sensor, and machine data. It is human-readable, editable with spreadsheets, and compatible with practically any data analysis tool.
Nominal is the leading platform for operationalizing test data.
This guide describes an automatable pipeline for uploading CSV files to Nominal.
Connect to Nominal
Get your Nominal API token from your User settings page.
See the Quickstart for more details on connecting to Nominal from Python.
Download sample data
For convenience and educational purposes, Nominal hosts test sample data on the Nominal Hugging Face account.
Let’s download a 1000 rows of data generated in the X-Plane flight simulator.
We’ll use the popular Polars library to download and inspect the data. Polars is installed automatically as part of the nominal
Python library.
source_time | f_act_sec | f_sim_sec | frame_time | cpu_time | gpu_time |
---|---|---|---|---|---|
str | f64 | f64 | f64 | f64 | f64 |
”2024-06-08T05:58:42.000Z” | 0.27645 | 19.9 | 3.61728 | 0.0022 | 0.00078 |
”2024-06-08T05:58:51.000Z” | 0.23154 | 19.9 | 4.31888 | 1.63362 | 0.13793 |
”2024-06-08T05:58:52.000Z” | 0.26435 | 32.30079 | 3.78289 | 3.77245 | 0.00089 |
”2024-06-08T05:58:52.000Z” | 0.29929 | 19.9 | 3.34123 | 3.77245 | 0.00089 |
”2024-06-08T05:58:52.000Z” | 0.34157 | 30.36099 | 2.9277 | 3.77245 | 0.00089 |
Upload your data to Nominal
You can upload this CSV file to Nominal with the upload_csv()
function.
Equivalently, since your CSV is already loaded in the Polars dataframe df
, you can upload it with the upload_polars()
method:
After upload, navigate to Nominal’s Datasets page (login required). You’ll see your CSV at the top!
Acceptable values for timestamp_type
include:
iso_8601
,
epoch_days
,
epoch_hours
,
epoch_minutes
,
epoch_seconds
,
epoch_milliseconds
,
epoch_microseconds
,
epoch_nanoseconds
,
relative_days
,
relative_hours
,
relative_minutes
,
relative_seconds
,
relative_milliseconds
,
relative_microseconds
,
relative_nanoseconds
Timestamps in the form 2024-06-08T05:58:42.000Z
will have a timestamp_type
of iso_8601
.
Timestamps in the form 1581933170999989
will most likely be epoch_microseconds
.
epoch_
timestamps refers to timestamps in Unix format.
For more information about Nominal timestamps in Python, see the
nominal.ts
docs page.