cdf2df

heliopy.data.util.cdf2df(cdf, index_key, dtimeindex=True, badvalues=None, ignore=None)

Converts a cdf file to a pandas dataframe.

Note that this only works for 1 dimensional data, other data such as distribution functions or pitch angles will not work properly.

Parameters:
  • cdf (cdf) – Opened CDF file.
  • index_key (string) – The CDF key to use as the index in the output DataFrame.
  • dtimeindex (bool, optional) – If True, the DataFrame index is parsed as a datetime. Default is True.
  • badvalues (dict, list, optional) – A dictionary that maps the new DataFrame column keys to a list of bad values to replace with nans. Alternatively a list of numbers which are replaced with nans in all columns.
  • ignore (list, optional) – In case a CDF file has columns that are unused / not required, then the column names can be passed as a list into the function.
Returns:

df – Data frame with read in data.

Return type:

pandas.DataFrame