You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/user_guide/io.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3717,6 +3717,7 @@ The look and feel of Excel worksheets created from pandas can be modified using
3717
3717
3718
3718
* ``float_format`` : Format string for floating point numbers (default ``None``).
3719
3719
* ``freeze_panes`` : A tuple of two integers representing the bottommost row and rightmost column to freeze. Each of these parameters is one-based, so (1, 1) will freeze the first row and first column (default ``None``).
3720
+
* ``autofilter`` : A boolean indicating whether to add automatic filters to all columns (default ``False``).
In most cases, parsing strings to datetimes (with any of :func:`to_datetime`, :class:`DatetimeIndex`, or :class:`Timestamp`) will produce objects with microsecond ("us") unit. The exception to this rule is if your strings have nanosecond precision, in which case the result will have "ns" unit:
Previously, :func:`to_datetime` and :class:`DatetimeIndex` would always parse strings to "ns" unit. During pandas 2.x, :class:`Timestamp` could give any of "s", "ms", "us", or "ns" depending on the specificity of the input string.
256
+
244
257
.. _timeseries.converting.format:
245
258
246
259
Providing a format argument
@@ -379,6 +392,16 @@ We subtract the epoch (midnight at January 1, 1970 UTC) and then floor divide by
Another common way to perform this conversion is to convert directly to an integer dtype. Note that the exact integers this produces will depend on the specific unit
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v3.0.0.rst
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -202,6 +202,7 @@ Other enhancements
202
202
- :class:`Holiday` has gained the constructor argument and field ``exclude_dates`` to exclude specific datetimes from a custom holiday calendar (:issue:`54382`)
203
203
- :class:`Rolling` and :class:`Expanding` now support ``nunique`` (:issue:`26958`)
204
204
- :class:`Rolling` and :class:`Expanding` now support aggregations ``first`` and ``last`` (:issue:`33155`)
205
+
- :func:`DataFrame.to_excel` has a new ``autofilter`` parameter to add automatic filters to all columns (:issue:`61194`)
205
206
- :func:`read_parquet` accepts ``to_pandas_kwargs`` which are forwarded to :meth:`pyarrow.Table.to_pandas` which enables passing additional keywords to customize the conversion to pandas, such as ``maps_as_pydicts`` to read the Parquet map data type as python dictionaries (:issue:`56842`)
206
207
- :func:`to_numeric` on big integers converts to ``object`` datatype with python integers when not coercing. (:issue:`51295`)
207
208
- :meth:`.DataFrameGroupBy.transform`, :meth:`.SeriesGroupBy.transform`, :meth:`.DataFrameGroupBy.agg`, :meth:`.SeriesGroupBy.agg`, :meth:`.SeriesGroupBy.apply`, :meth:`.DataFrameGroupBy.apply` now support ``kurt`` (:issue:`40139`)
@@ -233,7 +234,6 @@ Other enhancements
233
234
- Support reading Stata 102-format (Stata 1) dta files (:issue:`58978`)
234
235
- Support reading Stata 110-format (Stata 7) dta files (:issue:`47176`)
235
236
- Switched wheel upload to **PyPI Trusted Publishing** (OIDC) for release-tag pushes in ``wheels.yml``. (:issue:`61718`)
@@ -359,7 +359,7 @@ When passing strings, the resolution will depend on the precision of the string,
359
359
In [5]: pd.to_datetime(["2024-03-22 11:43:01.002003004"]).dtype
360
360
Out[5]: dtype('<M8[ns]')
361
361
362
-
The inferred resolution now matches that of the input strings:
362
+
The inferred resolution now matches that of the input strings for nanosecond-precision strings, otherwise defaulting to microseconds:
363
363
364
364
.. ipython:: python
365
365
@@ -368,13 +368,17 @@ The inferred resolution now matches that of the input strings:
368
368
In [4]: pd.to_datetime(["2024-03-22 11:43:01.002003"]).dtype
369
369
In [5]: pd.to_datetime(["2024-03-22 11:43:01.002003004"]).dtype
370
370
371
+
This is also a change for the :class:`Timestamp` constructor with a string input, which in version 2.x.y could give second or millisecond unit, which users generally disliked (:issue:`52653`)
372
+
371
373
In cases with mixed-resolution inputs, the highest resolution is used:
372
374
373
375
.. code-block:: ipython
374
376
375
377
In [2]: pd.to_datetime([pd.Timestamp("2024-03-22 11:43:01"), "2024-03-22 11:43:01.002"]).dtype
376
378
Out[2]: dtype('<M8[ns]')
377
379
380
+
.. warning:: Many users will now get "M8[us]" dtype data in cases when they used to get "M8[ns]". For most use cases they should not notice a difference. One big exception is converting to integers, which will give integers 1000x smaller.
0 commit comments