Skip to content

ENH: Option to store dataset creation/modification times with to_hdf. #44246

@rickhg12hs

Description

@rickhg12hs

Is your feature request related to a problem?

"I wish I could use pandas to" store a DataFrame with to_hdf and optionally include the datetime of dataset creation/modification.

Describe the solution you'd like

DataFrame.to_hdf should have an option that will store the datetime of dataset creation/modification.

[docstring addition]

with_datetime : bool, default False
    Stores `datetime` when dataset is written

API breaking implications

Shouldn't break anything.

Describe alternatives you've considered

A separate "metafile" that the user would need to write with dataset creation/modification datetimes.

Additional context

With the possibility of rewriting datasets, having the creation and modification times of the dataset in the HDF5 file would help to inform HDF5 file readers/users of updated datasets.

my_df.to_pdf(..., with_datetime=True, ...)
...
my_df_read = pd.read_hdf(store_file, key=key_value, mode="r")
print(my_df_read.ctime) # None or datetime
print(my_df_read.mtime) # None or datetime
...
my_df_read.info() # Would also show datetimes if present

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIO HDF5read_hdf, HDFStoreNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions