What’s new in 3.1.2 (November 30, 2026)#

These are the changes in pandas 3.1.2. See Release notes for a full changelog including other versions of pandas.

Fixed regressions#

  • Fixed a regression in arrays.SparseArray arithmetic with a timedelta64 scalar in a unit pandas does not support, such as np.timedelta64(1, "D"), raising TypeError (GH 71872)

  • Fixed a regression in read_csv() returning flat columns instead of a MultiIndex for tuple names on files of 5 MB or more (GH 71882)

  • Fixed a regression in read_csv() with engine="pyarrow" and parse_dates converting a non-date index_col (e.g. integers) to strings (GH 71873)

  • Fixed a regression in read_csv(), read_json() and read_xml() raising _”ValueError: I/O operation on closed file”_ when reading from a stream that closes itself once exhausted, such as a requests Response.raw object (GH 71983)

  • Fixed a regression in testing.assert_frame_equal(), testing.assert_series_equal() and the other assertion functions, where the failure message rounded float values to display.precision, so differing values could look identical (GH 71509)

  • Fixed a regression in CategoricalIndex.__contains__() returning wrong results when the categories are constructed from a range; values present in the index could be reported missing and unused categories reported as present (GH 72247)

  • Fixed a regression in DataFrame.ewm() and Series.ewm() with adjust=False and ignore_na=False returning incorrect results for data containing NaN when com=1 (equivalently span=3, alpha=0.5, or halflife=1) (GH 31178)

  • Fixed a regression in DataFrame.plot() and Series.plot() raising ConversionError when plotting timezone-aware datetime data containing missing values (GH 71879)

  • Fixed a regression in Series.sort_values() converting object dtype holding strings to str dtype when the values were not already sorted, and raising UnicodeEncodeError for strings containing lone surrogates; sorting now preserves object dtype as in pandas 2.x (GH 71978)

  • Fixed a regression in Timestamp.strftime() raising AttributeError instead of TypeError when format is not a string (GH 71914)

  • Fixed a regression in fillna() on arrays.DatetimeArray, arrays.TimedeltaArray and arrays.PeriodArray not raising on an invalid fill value when the array has no missing values (GH 36466)

Bug fixes#

  • Fixed SparseArray.from_indices() raising on datetime64 or timedelta64 data in a unit pandas does not support, and silently accepting unsorted, duplicate or negative indices with kind="block" (GH 71872)

Contributors#

A total of 7 people contributed patches to this release. People with a “+” by their names contributed a patch for the first time.

  • Aarya +

  • Ishan Kumar +

  • Joris Van den Bossche

  • Mutasim ur Rehman +

  • a12san +

  • jbrockmendel

  • pandas Development Team