to_dataframe

FileSet.to_dataframe(include_times=False, **kwargs)[source]

Create a pandas.Dataframe from this FileSet

This method creates a pandas.DataFrame containing all the filenames in this FileSet as row indices and the placeholders as columns.

Parameters:
  • include_times – If True, also the start and end time of each file are included. Default: False.

  • **kwargs – Additional keyword arguments which are allowed for find().

Returns:

A pandas.DataFrame with the filenames as row indices and the placeholders as columns.

Examples:

# Example directory:
# dir/
#   Satellite-A/
#       20190101-20190201.nc
#       20190201-20190301.nc
#   Satellite-B/
#       20190101-20190201.nc
#       20190201-20190301.nc

from typhon.files import FileSet

files = FileSet(
    'dir/{satellite}/{year}{month}{day}'
    '-{end_year}{end_month}{end_day}.nc'
)
df = files.to_dataframe()

# Content of df:
#                                       satellite
# /dir/Satellite-B/20190101-20190201.nc Satellite-B
# /dir/Satellite-A/20190101-20190201.nc Satellite-A
# /dir/Satellite-B/20190201-20190301.nc Satellite-B
# /dir/Satellite-A/20190201-20190301.nc Satellite-A