Repository navigation
Closed
Labels
Description
In pandas 1.1, the default behavior of handling datetimes has been deprecated. Previously they were treated like categoricals (gave things like unique). In the future they'll be treated like numerics (will give things like quantiles).
In [15]: df = pd.DataFrame({"A": pd.date_range("2000", periods=2)})
In [16]: ddf = dd.from_pandas(df, npartitions=1)
In [17]: df.describe()
/Users/taugspurger/.virtualenvs/dask-dev/bin/ipython:1: FutureWarning: Treating datetime data as categorical rather than numeric in `.describe` is deprecated and will be removed in a future version of pandas. Specify `datetime_is_numeric=True` to silence this warning and adopt the future behavior now.
#!/Users/taugspurger/Envs/dask-dev/bin/python
Out[17]:
A
count 2
unique 2
top 2000-01-01 00:00:00
freq 1
first 2000-01-01 00:00:00
last 2000-01-02 00:00:00
In [18]: ddf.describe()
/Users/taugspurger/sandbox/dask/dask/dataframe/core.py:2230: FutureWarning: Treating datetime data as categorical rather than numeric in `.describe` is deprecated and will be removed in a future version of pandas. Specify `datetime_is_numeric=True` to silence this warning and adopt the future behavior now.
meta = data._meta_nonempty.describe()
/Users/taugspurger/sandbox/dask/dask/dataframe/core.py:2128: FutureWarning: Treating datetime data as categorical rather than numeric in `.describe` is deprecated and will be removed in a future version of pandas. Specify `datetime_is_numeric=True` to silence this warning and adopt the future behavior now.
meta = self._meta_nonempty.describe(include=include, exclude=exclude)
Out[18]:
Dask DataFrame Structure:
A
npartitions=1
object
...
Dask Name: describe, 19 tasks
In [19]: _.compute()
Out[19]:
A
unique 2
count 2
top 2000-01-02 00:00:00
freq 1
first 2000-01-01 00:00:00
last 2000-01-02 00:00:00To silence this warning, we'll need to use datetime_is_numeric
In [21]: df.describe(datetime_is_numeric=True)
Out[21]:
A
count 2
mean 2000-01-01 12:00:00
min 2000-01-01 00:00:00
25% 2000-01-01 06:00:00
50% 2000-01-01 12:00:00
75% 2000-01-01 18:00:00
max 2000-01-02 00:00:00I don't know if we'll want to add that to our API or not.
Reacted by Bhaskoro Muthohar, Venkatachalam N and jacob idinye
Reacted by Julius Hernandez Alvarado
Reacted by jacob idinye
Activity
quasiben commentedon Jul 21, 2020
cc @shwina who might care about these changes as well
ideaguy3d commentedon Jun 17, 2021
NO. This is not a problem. I like this behavior
# Good ^_^df_in_date_range.describe()VS
# BAD >:(df_in_date_range.describe(datetime_is_numeric=True)I lose the
filecolumn in Jupyter Notebooks... It took me hours upon hours to figure out how to read the files from disk and parse them correctly in pandas and now I'm dealing with this damn warning:
FutureWarning: Treating datetime data as categorical rather than numeric in.describeis deprecated and will be removed in a future version of pandas. Specifydatetime_is_numeric=Trueto silence this warning and adopt the future behavior now.We should have the freedom to use datetime data as a categorical. Do NOT force us to convert it to a numeric!