hydromt.data_adapter.DataFrameAdapter.to_file#

DataFrameAdapter.to_file(data_root: str | ~pathlib.Path, data_name: str, driver: str | None = None, variables: str | ~typing.List[str] | None = None, time_tuple: ~typing.Tuple[~datetime.datetime, ~datetime.datetime] | None = None, handle_nodata: ~hydromt.nodata.NoDataStrategy = NoDataStrategy.RAISE, logger: ~logging.Logger = <Logger hydromt.data_adapter.dataframe (WARNING)>, **kwargs) Tuple[str | Path, str, Dict[str, Any]] | None[source]#

Save a dataframe slice to a file.

Parameters:
  • data_root (str or Path) – Path to the output folder.

  • data_name (str) – Name of the output file without extension.

  • driver (str, optional) – Driver to write the file, e.g., ‘csv’,’parquet’, ‘excel’. If None, the default behavior is used.

  • variables (list of str, optional) – Names of DataFrame columns to include in the output. By default, all columns are included.

  • time_tuple (tuple of str or datetime, optional) – Start and end date of the period of interest. By default, the entire time period of the DataFrame is included.

  • **kwargs (dict) – Additional keyword arguments to be passed to the file writing method.

Returns:

  • fn_out (str) – Absolute path to the output file.

  • driver (str) – Name of the driver used to read the data. See get_geodataset().

  • kwargs (dict) – The additional keyword arguments that were passed in.