ctdfjorder.CTD.CTD.expand_date(self, year: bool = True, month: bool = True, day: bool = True)#

Expands the timestamp column into separate year, month, and day columns.

Parameters:
  • year (bool, default True) – If True, adds a year column.

  • month (bool, default True) – If True, adds a month column.

  • day (bool, default True) – If True, adds a day column.

Raises:

NoSamplesError – When the function is called on a CTD object with no data.

Notes

This method modifies the CTD data in-place by adding new columns for year, month, and/or day, depending on the parameters provided. The original timestamp column is preserved.

Examples

ctd_data = CTD('example.csv')
ctd_data.expand_date(year=True, month=True, day=False)
# This will add year and month columns to the dataset, but not a day column.