This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
data:data_analysis_manual:read_catalog_python [2022/08/27 10:01] eric buchlin Add function to read the CSV catalog |
data:data_analysis_manual:read_catalog_python [2022/08/30 18:20] eric buchlin Read catalog included in releases |
||
---|---|---|---|
Line 35: | Line 35: | ||
df = pd.read_table(cat_file, parse_dates=date_columns, date_parser=date_parser) | df = pd.read_table(cat_file, parse_dates=date_columns, date_parser=date_parser) | ||
return df | return df | ||
+ | </file> | ||
+ | |||
+ | The same applies for the catalog included in the data releases (here: release 2.0), which can simply be read by: | ||
+ | |||
+ | <file python read_release_cat.py> | ||
+ | import pandas as pd | ||
+ | |||
+ | def date_parser(string): | ||
+ | try: | ||
+ | return pd.Timestamp(string) | ||
+ | except ValueError: | ||
+ | return pd.NaT | ||
+ | |||
+ | date_columns = ['DATE-BEG','DATE', 'TIMAQUTC'] | ||
+ | cat = pd.read_csv( | ||
+ | 'https://spice.osups.universite-paris-saclay.fr/spice-data/release-2.0/catalog.csv', | ||
+ | date_parser=date_parser, | ||
+ | parse_dates=date_columns | ||
+ | ) | ||
+ | # TODO interpret the JSON included in columns `proc_steps` and `windows`. | ||
</file> | </file> | ||