File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -34,9 +34,9 @@ def load_data( # noqa: PLR0913
3434 db_index : pd .DataFrame ,
3535 db_file_map : pd .Series [Path ], # type: ignore # pandas type hints confused about what they support
3636 db_dir : Path ,
37- out_columns_name : str | None ,
3837 selector : pd .Index [Any ] | pd .MultiIndex | pix .selectors .Selector | None = None ,
3938 out_columns_type : type | None = None ,
39+ out_columns_name : str | None = None ,
4040 parallel_op_config : ParallelOpConfig | None = None ,
4141 progress : bool = False ,
4242 max_workers : int | None = None ,
@@ -69,6 +69,8 @@ def load_data( # noqa: PLR0913
6969 out_columns_name
7070 The name for the columns in the output.
7171
72+ If not supplied, we don't set the output columns' name.
73+
7274 This can also be set with
7375 [pd.DataFrame.rename_axis][pandas.DataFrame.rename_axis]
7476 but we provide it here for convenience
Original file line number Diff line number Diff line change @@ -409,6 +409,8 @@ def load( # noqa: PLR0913
409409 out_columns_name
410410 The name for the columns in the output.
411411
412+ If not supplied, we don't set the output columns' name.
413+
412414 This can also be set with
413415 [pd.DataFrame.rename_axis][pandas.DataFrame.rename_axis]
414416 but we provide it here for convenience
Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ def load( # noqa: PLR0913
117117 out_columns_name
118118 The name for the columns in the output.
119119
120+ If not supplied, we don't set the output columns' name.
121+
120122 This can also be set with
121123 [pd.DataFrame.rename_axis][pandas.DataFrame.rename_axis]
122124 but we provide it here for convenience
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ def load_timeseries_csv(
1414 lower_column_names : bool = True ,
1515 index_columns : list [str ] | None = None ,
1616 out_column_type : type | None = None ,
17+ out_columns_name : str | None = None ,
1718) -> pd .DataFrame :
1819 """
1920 Load a CSV holding timeseries
@@ -47,6 +48,16 @@ def load_timeseries_csv(
4748
4849 If not supplied, the raw type returned by pandas is returned.
4950
51+ out_columns_name
52+ The name for the columns in the output.
53+
54+ If not supplied, the raw name returned by pandas is returned.
55+
56+ This can also be set with
57+ [pd.DataFrame.rename_axis][pandas.DataFrame.rename_axis]
58+ but we provide it here for convenience
59+ (and in case you couldn't find this trick for ages, like us).
60+
5061 Returns
5162 -------
5263 :
@@ -65,4 +76,7 @@ def load_timeseries_csv(
6576 if out_column_type is not None :
6677 out .columns = out .columns .astype (out_column_type )
6778
79+ if out_columns_name is not None :
80+ out = out .rename_axis (out_columns_name , axis = "columns" )
81+
6882 return out
You can’t perform that action at this time.
0 commit comments