Skip to content

Commit 5570288

Browse files
authored
Remove deprecated pd_dataframe() and pd_series() (#2733)
* remove TimeSeries.pd_*() * update changelog
1 parent b2c842e commit 5570288

File tree

8 files changed

+10
-59
lines changed

8 files changed

+10
-59
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ but cannot always guarantee backwards compatibility. Changes that may **break co
1111

1212
**Improved**
1313

14+
**Removed**
15+
- 🔴 Removed deprecated method `TimeSeries.pd_dataframe()`. Use `TimeSeries.to_dataframe()` instead. [#2733](https://github.com/unit8co/darts/pull/2733) by [Dennis Bader](https://github.com/dennisbader).
16+
- 🔴 Removed deprecated method `TimeSeries.pd_serise()`. Use `TimeSeries.to_series()` instead. [#2733](https://github.com/unit8co/darts/pull/2733) by [Dennis Bader](https://github.com/dennisbader).
17+
1418
**Fixed**
1519

1620
**Dependencies**

darts/tests/test_timeseries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2077,7 +2077,7 @@ def test_to_csv_deterministic(self, pddf_mock):
20772077
ts.to_csv("test.csv")
20782078
pddf_mock.assert_called_once()
20792079

2080-
@patch("darts.timeseries.TimeSeries.pd_dataframe")
2080+
@patch("darts.timeseries.TimeSeries.to_dataframe")
20812081
def test_to_csv_stochastic(self, pddf_mock):
20822082
ts = TimeSeries(
20832083
xr.DataArray(

darts/timeseries.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959

6060
from darts.logging import (
6161
get_logger,
62-
raise_deprecation_warning,
6362
raise_if,
6463
raise_if_not,
6564
raise_log,
@@ -1823,29 +1822,6 @@ def to_series(
18231822

18241823
return pd.Series(data=data, index=index, name=name)
18251824

1826-
def pd_series(self, copy: bool = True) -> pd.Series:
1827-
"""
1828-
Return a Pandas Series representation of this time series.
1829-
1830-
Works only for univariate series that are deterministic (i.e., made of 1 sample).
1831-
1832-
Parameters
1833-
----------
1834-
copy
1835-
Whether to return a copy of the series. Leave it to True unless you know what you are doing.
1836-
1837-
Returns
1838-
-------
1839-
pandas.Series
1840-
A Pandas Series representation of this univariate time series.
1841-
"""
1842-
raise_deprecation_warning(
1843-
"`TimeSeries.pd_series()` is deprecated and will be removed in Darts version 0.35.0. Use "
1844-
"`TimeSeries.to_series()` instead",
1845-
logger,
1846-
)
1847-
return self.to_series(copy=copy)
1848-
18491825
def to_dataframe(
18501826
self,
18511827
copy: bool = True,
@@ -1926,35 +1902,6 @@ def to_dataframe(
19261902

19271903
return nw.from_dict(data, backend=backend).to_native()
19281904

1929-
def pd_dataframe(self, copy=True, suppress_warnings=False) -> pd.DataFrame:
1930-
"""
1931-
Return a Pandas DataFrame representation of this time series.
1932-
1933-
Each of the series components will appear as a column in the DataFrame.
1934-
If the series is stochastic, the samples are returned as columns of the dataframe with column names
1935-
as 'component_s#' (e.g. with two components and two samples:
1936-
'comp0_s0', 'comp0_s1' 'comp1_s0' 'comp1_s1').
1937-
1938-
Parameters
1939-
----------
1940-
copy
1941-
Whether to return a copy of the dataframe. Leave it to True unless you know what you are doing.
1942-
suppress_warnings
1943-
Whether to suppress the warnings for the `DataFrame` creation.
1944-
1945-
Returns
1946-
-------
1947-
pandas.DataFrame
1948-
The Pandas DataFrame representation of this time series
1949-
"""
1950-
1951-
raise_deprecation_warning(
1952-
"`TimeSeries.pd_dataframe()` is deprecated, and will be removed in Darts version 0.35.0. Use "
1953-
"`TimeSeries.to_dataframe()` instead",
1954-
logger,
1955-
)
1956-
return self.to_dataframe(copy=copy, suppress_warnings=suppress_warnings)
1957-
19581905
def quantile_df(self, quantile=0.5) -> pd.DataFrame:
19591906
"""
19601907
Return a Pandas DataFrame containing the single desired quantile of each component (over the samples).

examples/05-TCN-examples.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@
437437
}
438438
],
439439
"source": [
440-
"df3 = EnergyDataset().load().pd_dataframe()\n",
440+
"df3 = EnergyDataset().load().to_dataframe()\n",
441441
"df3_day_avg = (\n",
442442
" df3.groupby(df3.index.astype(str).str.split(\" \").str[0]).mean().reset_index()\n",
443443
")\n",

examples/07-NBEATS-examples.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
}
116116
],
117117
"source": [
118-
"df = EnergyDataset().load().pd_dataframe()\n",
118+
"df = EnergyDataset().load().to_dataframe()\n",
119119
"df[\"generation hydro run-of-river and poundage\"].plot()\n",
120120
"plt.title(\"Hourly generation hydro run-of-river and poundage\")"
121121
]

examples/08-DeepAR-examples.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
}
262262
],
263263
"source": [
264-
"df3 = EnergyDataset().load().pd_dataframe()\n",
264+
"df3 = EnergyDataset().load().to_dataframe()\n",
265265
"df3_day_avg = (\n",
266266
" df3.groupby(df3.index.astype(str).str.split(\" \").str[0]).mean().reset_index()\n",
267267
")\n",

examples/09-DeepTCN-examples.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
}
232232
],
233233
"source": [
234-
"df3 = EnergyDataset().load().pd_dataframe()\n",
234+
"df3 = EnergyDataset().load().to_dataframe()\n",
235235
"df3_day_avg = (\n",
236236
" df3.groupby(df3.index.astype(str).str.split(\" \").str[0]).mean().reset_index()\n",
237237
")\n",

examples/21-TSMixer-examples.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
" trafo = ds().load().astype(np.float32)\n",
275275
" trafo = trafo.with_static_covariates(pd.DataFrame({\"transformer_id\": [idx]}))\n",
276276
" series.append(trafo)\n",
277-
"series[0].pd_dataframe()"
277+
"series[0].to_dataframe()"
278278
]
279279
},
280280
{

0 commit comments

Comments
 (0)