|
| 1 | +Title: pandas 3.0 released! |
| 2 | +Date: 2026-01-21 |
| 3 | + |
| 4 | +# pandas 3.0 released! |
| 5 | + |
| 6 | +We're excited to announce the release of pandas 3.0.0. This major |
| 7 | +long-awaited release brings significant improvements to pandas, but also |
| 8 | +features some potentially breaking changes. |
| 9 | + |
| 10 | +## Highlights of pandas 3.0 |
| 11 | + |
| 12 | +pandas 3.0 introduces several major enhancements: |
| 13 | + |
| 14 | +- **Dedicated string data type by default**: string columns are now inferred as |
| 15 | + the new `str` dtype instead of `object`, providing better performance and type |
| 16 | + safety |
| 17 | +- **Consistent copy/view behaviour with Copy-on-Write (CoW)** (a.k.a. getting |
| 18 | + rid of the `SettingWithCopyWarning`): more predictable and consistent behavior |
| 19 | + for all operations, with improved performance through avoiding unnecessary |
| 20 | + copies |
| 21 | +- **New default resolution for datetime-like data**: no longer defaulting to |
| 22 | + nanoseconds, but generally microseconds (or the resolution of the input), when |
| 23 | + constructing datetime or timedelta data (avoiding out-of-bounds errors |
| 24 | + for dates with a year before 1678 or after 2262) |
| 25 | +- **New `pd.col` syntax**: initial support for `pd.col()` as a simplified syntax |
| 26 | + for creating callables in `DataFrame.assign` |
| 27 | + |
| 28 | +Further, pandas 3.0 includes a lot of other improvements and bug fixes. You can |
| 29 | +find the complete list of changes in the |
| 30 | +[release notes](https://pandas.pydata.org/docs/dev/whatsnew/v3.0.0.html). |
| 31 | + |
| 32 | +## Upgrading to pandas 3.0 |
| 33 | + |
| 34 | +The pandas 3.0 release removed functionality that was deprecated in previous releases |
| 35 | +(see [here](https://pandas.pydata.org/docs/whatsnew/v3.0.0.html#whatsnew-300-prior-deprecations) |
| 36 | +for an overview). It is recommended to first upgrade to pandas 2.3 and to ensure |
| 37 | +your code is working without warnings, before upgrading to pandas 3.0. |
| 38 | + |
| 39 | +Further, as a major release, pandas 3.0 includes some breaking changes that may |
| 40 | +require updates to your code. The two most significant changes are the new |
| 41 | +string dtype and the copy/view behaviour changes, detailed below. An overview of |
| 42 | +all potentially breaking changes can be found in the [Backwards incompatible API |
| 43 | +changes](https://pandas.pydata.org/docs/whatsnew/v3.0.0.html#backwards-incompatible-api-changes) |
| 44 | +section of the release notes. |
| 45 | + |
| 46 | +### 1. Dedicated string data type by default |
| 47 | + |
| 48 | +Starting with pandas 3.0, string columns are automatically inferred as `str` |
| 49 | +dtype instead of the numpy `object` (which can store any Python object). |
| 50 | + |
| 51 | +**Example:** |
| 52 | +```python |
| 53 | +# Old behavior (pandas < 3.0) |
| 54 | +>>> ser = pd.Series(["a", "b"]) |
| 55 | +>>> ser |
| 56 | +0 a |
| 57 | +1 b |
| 58 | +dtype: object # <-- numpy object dtype |
| 59 | + |
| 60 | +# New behavior (pandas 3.0) |
| 61 | +>>> ser = pd.Series(["a", "b"]) |
| 62 | +>>> ser.dtype |
| 63 | +>>> ser |
| 64 | +0 a |
| 65 | +1 b |
| 66 | +dtype: str # <-- new string dtype |
| 67 | +``` |
| 68 | + |
| 69 | +This change improves performance and type safety, but may require code updates, |
| 70 | +especially for library code that currently looks for "object" dtype when |
| 71 | +expecting string data. |
| 72 | + |
| 73 | +For more details, see the |
| 74 | +[migration guide for the new string data type](https://pandas.pydata.org/docs/dev/user_guide/migration-3-strings.html). |
| 75 | + |
| 76 | +This new data type will use the `pyarrow` library under the hood, if installed, |
| 77 | +to provide the performance improvements. Therefore we strongly recommend to |
| 78 | +install `pyarrow` alongside pandas (but `pyarrow` is not a required dependency |
| 79 | +installed by default). |
| 80 | + |
| 81 | +### 2. Consistent copy/view behaviour with Copy-on-Write (CoW) |
| 82 | + |
| 83 | +Copy-on-Write is now the default and only mode in pandas 3.0. This makes |
| 84 | +behavior more consistent and predictable, and avoids a lot of defensive copying |
| 85 | +(improving performance), but requires updates to certain coding patterns. |
| 86 | + |
| 87 | +The most impactfull change is that **chained assignment will no longer work**. |
| 88 | +As a result, the `SettingWithCopyWarning` is also removed (since there is no |
| 89 | +longer ambiguity whether it would work or not), and defensive `.copy()` calls |
| 90 | +to silence the warning are no longer needed. |
| 91 | + |
| 92 | +**Example:** |
| 93 | +```python |
| 94 | +# Old behavior (pandas < 3.0) - chained assignment |
| 95 | +df["foo"][df["bar"] > 5] = # This might modify df (unpredictable) |
| 96 | + |
| 97 | +# New behavior (pandas 3.0) - must do the modification in one step (e.g. with .loc) |
| 98 | +df.loc[df["bar"] > 5, "foo"] = 100 |
| 99 | +``` |
| 100 | + |
| 101 | +In general, any result of an indexing operation or method now always behaves as |
| 102 | +if it were a copy, so modifications of the result won't affect the original |
| 103 | +DataFrame. |
| 104 | + |
| 105 | +For more details, see the |
| 106 | +[Copy-on-Write migration guide](https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html#migrating-to-copy-on-write). |
| 107 | + |
| 108 | +## Obtaining pandas 3.0 |
| 109 | + |
| 110 | +You can install the latest pandas 3.0 release from PyPI: |
| 111 | + |
| 112 | +```bash |
| 113 | +python -m pip install --upgrade pandas==3.0.* |
| 114 | +``` |
| 115 | + |
| 116 | +Or from conda-forge using conda/mamba: |
| 117 | + |
| 118 | +```bash |
| 119 | +conda install -c conda-forge pandas=3.0 |
| 120 | +``` |
| 121 | + |
| 122 | +## Running into an issue or regression? |
| 123 | + |
| 124 | +Please report any problem you encounter with the release on the pandas [issue tracker](https://github.com/pandas-dev/pandas/issues). |
| 125 | + |
| 126 | +Thanks to all the contributors who made this release possible! |
0 commit comments