What’s new in 3.2.0 (Month XX, 2027)#
These are the changes in pandas 3.2.0. See Release notes for a full changelog including other versions of pandas.
Enhancements#
enhancement1#
enhancement2#
Other enhancements#
read_csv()andread_table()withsep=Nonenow sniff the separator with the C engine instead of falling back to the slower python engine (GH 9645)read_csv()with the"c"and"python"engines now accepts aDatetimeTZDtypeindtype(GH 24542)DataFrameGroupBy.rank()andSeriesGroupBy.rank()now accept anumeric_onlyargument, matchingDataFrame.rank()(GH 44438)DataFrame.to_csv()and other writers now accept anos.PathLikesuch aspathlib.Pathfor thearchive_nameentry of a zip or tarcompressiondict (GH 31934)Series.groupby()now acceptsas_index=False, returning aggregation results as aDataFramewith the group labels as columns (GH 36507)Added
Categorical.to_dense()andSeries.cat.to_dense()to get the values with the dtype of the categories, including extension dtypes (GH 26410)Added
DatetimeIndex.set_freq()andTimedeltaIndex.set_freq(), which return a new index with the givenfreqinstead of modifying it in place (GH 61094)Display formatting for complex numbers in
objectdtype and forintervaldtype values with float endpoints now respects thedisplay.precisionanddisplay.float_formatoptions (GH 25920).Printing a
Stylernow shows the underlying data instead of the object’s address, so the table also appears in notebooks exported to PDF withnbconvert(GH 55908)The
ExtensionArraybase tests inpandas.tests.extension.basenow issue aerrors.PerformanceWarningwhen the array uses the default, possibly slow, implementation ofunique,factorize,argsort,argmin,argmax, orsearchsorted(GH 24433)
Notable bug fixes#
These are bug fixes that might have notable behavior changes.
notable_bug_fix1#
notable_bug_fix2#
Backwards incompatible API changes#
Increased minimum versions for dependencies#
Some minimum supported versions of dependencies were updated. If installed, we now require:
Package |
Minimum Version |
Required |
Changed |
|---|---|---|---|
X |
X |
For optional libraries the general recommendation is to use the latest version. The following table lists the lowest version per library that is currently being tested throughout the development of pandas. Optional libraries below the lowest tested version may still work, but are not considered supported.
Package |
Minimum Version |
Changed |
|---|---|---|
X |
See Dependencies and Optional dependencies for more.
Other API changes#
Stylernow displays missing float values asNaNrather thannanby default, matchingDataFrame(GH 12710)Indexnow displays missing float values asNaNrather thannanin its repr, matchingSeriesandDataFrame(GH 64733)DataFrame.copy()andSeries.copy()withdeep=True(the default), andArrowExtensionArray.copy(), now copy pyarrow-backed data instead of sharing its memory, so a copy no longer keeps the original’s memory alive (GH 61930)DataFrame.query()now raises aValueErrorwhen the expression does not evaluate to a boolean array, instead of silently using the result as row labels; useDataFrame.locfor label selection (GH 8560)
Deprecations#
deprecation1#
deprecation2#
Other deprecations#
Deprecated
merge()andDataFrame.join()producing duplicated columns when suffixed left and right column labels collide, e.g.suffixes=("_x", "_x"); this will raise aMergeErrorin a future version (GH 13659)Deprecated
median,min,max,idxmin,idxmax,argmin,argmax,cummin,cummax,clip, and the comparisons<,<=,>,>=oncomplexdata; complex numbers have no natural ordering, so in a future version these will raiseTypeError(GH 43770, GH 70087)Deprecated
pandas.to_pickle, use theDataFrame.to_pickle()orSeries.to_pickle()method instead (GH 48402)Deprecated passing
Noneentries inobjstoconcat(); filter them out before callingconcat()instead (GH 57846)Deprecated passing a negative
min_counttoDataFrame.sum(),DataFrame.prod(),Series.sum(),Series.prod(),TimedeltaIndex.sum(), thesumandprodmethods of pandas arrays, and thesum,prod,min,max,first, andlastmethods ofDataFrameGroupBy,SeriesGroupBy, andResampler. Passmin_count=0instead, which behaves the same (GH 50022)Deprecated setting an out-of-bounds numpy scalar into an array of a numpy-nullable integer dtype. The value is currently stored altered to fit (
np.int64(-1)becomes255inUInt8); in a future version this will raise, as it already does for a Python integer. Cast the array to a dtype that can hold the value first (GH 48867)Deprecated the
DataFrameconstructor,DataFrame.from_dict()withorient="index", andDataFrame.from_records()splitting astrorbytesrow into its elements when the first row is list-like; in a future version this will raiseTypeError. Passlist(row)instead (GH 50461)Deprecated the
cache_datesargument inread_csv(),read_table(), andread_fwf()(GH 68705)Deprecated the
columnskeyword inSeries.drop(), which was silently ignored; useindexorlabelsinstead (GH 39509)Deprecated constructing a
DataFramecolumn,Indexorarray()from a NumPy structured (compound) array, and casting to a compound dtype withDataFrame.astype(),Series.astype()orarray(); these will raise in a future version, as theSeriesconstructor already does. Usepd.DataFrame(arr)for one column per field orarr.astype(object)for tuples (GH 4464, GH 49388, GH 60108)
Performance improvements#
Performance improvement in
read_csv()withengine="c"across the board, in tokenizing and in the machinery shared by all column types; large uncompressed local files are additionally read in parallel across multiple CPU cores by default, see above (GH 64347, GH 64515, GH 65350, GH 66271, GH 66272, GH 66273, GH 66274, GH 66276, GH 66798, GH 68314, GH 69632, GH 69748, GH 70140)Performance improvement in
read_csv()with a dictdtypeon wide files or with a smallchunksize(GH 70769)Performance improvement in
DataFrame.skew()andDataFrame.kurt()with types different fromfloat64(GH 66662)Performance improvement in
DataFrameGroupBy.pct_change()andSeriesGroupBy.pct_change()(GH 70972)Performance improvement in
PeriodIndex.strftime()with a customdate_format(GH 70106)Performance improvement in
Series.var(),Series.std(),Series.sem(), and theirDataFrameequivalents when bottleneck is disabled (GH 64884)Reduced memory usage of
DataFrame.loc()andDataFrame.iloc()when selecting a single row or a small slice of rows together with a list of columns (GH 69477)
Bug fixes#
Categorical#
Bug in
DataFrame.values,DataFrame.to_numpy()andDataFrame.transpose()silently converting missing values in aCategoricalcolumn with integer or boolean categories to arbitrary integers orTrue(GH 38240)Bug in
Series.clip()andDataFrame.clip()with ordered categorical data orderinglowerandupperby value instead of by category position (GH 49217)Bug in comparing a
Categoricalwith an iterator raisingTypeErrorinstead of treating it as a scalar, as with a tuple (GH 31646)Bug in comparing unordered
Categoricalobjects with mixed-type categories in a different order raisingTypeError;Categorical.equals()andmerge()were also affected (GH 51543)
Datetimelike#
Bug in
DataFrame.astype(),Series.astype(),Index.astype(),DatetimeIndex,array()andto_datetime()wherefloatdtype data outside theint64range, such asinf, silently became a valid-lookingdatetime64/timedelta64value orNaT; these now raiseOutOfBoundsDatetime/OutOfBoundsTimedelta(GH 68926)Bug in
DatetimeIndex.strftime(),Series.dt.strftime(), andDataFrame.to_csv()withdate_formaton Windows silently replacing values thatTimestamp.strftime()cannot format (e.g.%yfor years before 1900) with their default string representation; these now raiseValueError(GH 58178)Bug in
Series.isin(),DataFrame.isin(), andIndex.isin()on datetime-like data missingnumpy.datetime64ornumpy.timedelta64values (NaT, or any value on numpy < 2.2) whenvaluesalso held non-datetime-like entries (GH 71186)Bug in
!=between aTickoffset such asHourand an array-like oftimedelta64values orpd.NAraisingValueErrororTypeError(GH 71162)Bug in comparisons, indexing, setitem and
Series.astype()toCategoricalDtypewith datetime, timedelta or period values not parsingArrowDtypestringandlarge_stringvalues the wayStringDtypevalues are parsed (GH 62051)
Timedelta#
Timezones#
Bug in
DataFrame.query()andDataFrame.eval()comparing a timezone-aware datetime column to a string without a UTC offset raisingTypeErroror returning incorrect results; the string is now localized to the column’s timezone, as indf["col"] < "2000-01-02"(GH 26236)
Numeric#
Bug in
Series.skew()andSeries.kurt()(and theirDataFramecounterparts) oncomplexdata discarding the imaginary part; these now raiseTypeError(GH 43770)Bug in
Series.var()andSeries.std()(and theirDataFramecounterparts) returning very inaccurate results for largefloat32data when bottleneck is installed (GH 70945)Bug in integer exponentiation (
**,Series.pow(),DataFrame.pow()) on large inputs returning imprecise results,0for negative exponents, or an upcast dtype when numexpr is installed (GH 54546)Fixed bug in
Series.corr()withmethod="pearson"returning an inaccurate result for nearly-constant data, and0.0instead ofNaNfor some constant data (GH 59652)Fixed bug in
Series.isin(),DataFrame.isin(), andIndex.isin()reporting false matches whenvalueswas a list of integers above2**53mixed with floats,NaN, or integers outside theint64range, or a list ofbytesending in a null byte (GH 70217)Fixed bug in
Series.var(),Series.std(), andSeries.sem()(and theirDataFramecounterparts) returninginfor incorrect results forfloat16dtypes when the variance or the number of values exceeded thefloat16range; these now returnfloat64likeSeries.mean()(GH 41277)
Conversion#
Bug in
DataFrameconstructor andDataFrame.from_records()where a list ofSerieswith extension dtypes lost those dtypes (GH 56231)Bug in
to_numeric()with a datetime-like scalar not matching the result for aSeriesholding the value (GH 43280)Bug in
DataFrame.compare()andSeries.compare()upcasting integer and boolean columns when the equal values were only in rows dropped from the result (GH 39899)Bug in
DataFrame.from_records()not dropping theexcludeandindexcolumns when all of their labels were falsy, such as0(GH 18679)Bug in
DataFrame.replace()with a dict or list replacing values withNonecasting other columns of the same dtype toobjecteven when they contained no value to replace (GH 30512)Bug in
DataFrame.to_dict()andSeries.to_dict()sometimes returning NumPy complex scalars instead of Pythoncomplex(GH 27616)Bug in
Series.astype()andarray()raisingTypeErrorwhen converting object-dtype data mixing integers and integer strings (e.g.[1, "1"]) to a nullable integer dtype (GH 34460)Fixed bug in
to_numeric()witherrors="coerce"raisingTypeErrorfor object values containing unhashable nested elements, such as a tuple containing a list, instead of coercing them toNaN(GH 69916)
Strings#
Bug in
StringDtypewith PyArrow storage rejecting a PyArrow string scalar in item assignment andSeries.fillna(), andSeries.where()with one storing a character code (GH 71075)Bug in
DataFrame.replace()andSeries.replace()silently ignoring a compiledre.PatternforArrowDtypestringandlarge_stringdtypes, including aCategoricalof them (GH 69026)Bug in
DataFrame.replace()andSeries.replace()withregex=TrueonArrowDtypestringandlarge_stringdtypes raising or silently coercing a replacement the column cannot hold instead of casting toobject(GH 70458)
Interval#
Bug in
IntervalIndex.midandarrays.IntervalArray.midreturning incorrect values for numeric endpoints whose sum overflows their dtype (GH 25499)Bug in
IntervalIndexset operations with an emptyRangeIndex, and inIntervalIndexconstruction orastype("interval")from aRangeIndexor non-interval extension array, raising an uninformativeTypeError(GH 68343)Bug in
concat()andIndex.append()withIntervalDtypenot retaining an extension dtype subtype, either casting it to a NumPy dtype or raisingTypeError(GH 64297)Bug in
interval_range()with large integerstartorendsilently returning too few intervals, or empty or wrongly spaced intervals, due to float precision loss (GH 71288)Bug in
Series.shift()andDataFrame.shift()with anIntervalDtypecolumn not retaining the subtype, either changing it or raisingTypeError(GH 69922)
Indexing#
Bug in
DataFrame.__setitem__()silently corrupting theDataFramewhen the key matched several columns andvaluewas a timezone-awaredatetime64orperiodscalar, or a one-dimensionalSeriesof either dtype; it now broadcasts across the matched columns as the other dtypes already did (GH 71078)Bug in
DataFrame.__setitem__()silently corrupting theDataFrame, or dropping columns ofvalue, when the key matched several columns (duplicate orMultiIndexcolumns) andvaluewas a two-dimensional array without one column per matched column; it now raisesValueError(GH 68445)Bug in
DataFrame.isetitem()with several positions silently corrupting theDataFrame, or dropping columns ofvalue, when an arraylikevaluedid not have one column per position; it now raisesValueError(GH 68445)Bug in
DataFrame.loc()andDataFrame.at()setitem with a single row label adding a new column from a list-like value raising or setting the wrong value (GH 30649)Bug in
DataFrame.loc()andDataFrame.iloc()raising or flattening a 2D value (e.g. a list of lists) set into a singleobjectcell of a mixed-dtypeDataFrame(GH 69152)Bug in
DataFrame.loc()andDataFrame.iloc()setitem on a 1-columnDataFramewith an extension dtype raising when the column key is an all-Falseboolean mask or an empty list-like (GH 70232)Bug in
DataFrame.loc()andSeries.loc()raisingKeyErrorfor aTrueorFalselabel present in an object-dtypeIndexor the first level of aMultiIndex(GH 50165)Bug in
DataFrame.loc()andSeries.loc()setitem with an integer slice raisingTypeErrorwhere the same.locgetitem succeeds, e.g. on an index ofdecimal.Decimalvalues (GH 70219)Bug in
DataFrame.loc()andSeries.loc()slicing with an integer or float bound that is not in the index: an object-dtype index of numbers (e.g.decimal.Decimal) raisedTypeErrorinstead of slicing by sort order, and a non-monotonic index of non-string values raisedTypeErrorinstead ofKeyError(GH 70295)Bug in
Index.difference()dropping elements that are not inotherwhenotherwas aDatetimeIndex,TimedeltaIndexorPeriodIndexand the elements were strings that parse to its values, or whenotherwas anIntervalIndexand the elements were scalars contained in its intervals (GH 58971)
Missing#
Bug in
DataFrame.ffill()andDataFrame.bfill()withaxis=1andinplace=Truenot modifying theDataFrameand returning a new object instead ofself(GH 71159)Bug in
DataFrame.interpolate()andSeries.interpolate()withmethod="index","values","time"or a SciPy method giving incorrect results for a nanosecond-resolutionDatetimeIndexorTimedeltaIndexspanning less than about 104 days, or an integer index with values beyond2**53spanning less than2**53(GH 34601)Bug in
DataFrame.interpolate()andSeries.interpolate()with a largelimitraising on 32-bit platforms and being very slow on long runs of missing values (GH 34936)Bug in
DataFrame.mask(),DataFrame.where(),Series.mask(), andSeries.where()handling missing values in a nullable booleancondinconsistently between the two methods and depending oninplace; missing values are now treated asFalse, as in boolean indexing (GH 35429, GH 52955, GH 56844, GH 60729)
MultiIndex#
Bug in
MultiIndexconstructor andMultiIndex.set_codes()silently convertingNaNor non-integer float codes to valid codes instead of raisingValueError(GH 26210)Bug in
DataFrame.sort_index(),Series.sort_index(),MultiIndex.sort_values()andMultiIndex.is_monotonic_increasing()ignoring the category order of aCategoricalIndexlevel (GH 47607)Bug in
MultiIndex.append(),concat(),DataFrame.join()andmerge()emitting a spuriousRuntimeWarningwhenMultiIndexlevel values could not be sorted (GH 61477)Bug in
MultiIndex.from_tuples()with an objectndarray,MultiIndex.append()andIndex.map()truncating or raisingIndexErroron tuples of different lengths;MultiIndex.from_tuples()now raises aValueErrorfor anndarrayof tuples of different lengths (GH 50293)Bug in
MultiIndex.rename()raisingTypeErrorfor thenamekeyword documented byIndex.rename()(GH 33778)Bug in
Series.map(),Index.get_indexer(),DataFrame.reindex()andDataFrame.locwith aMultiIndexraisingIndexErroror matching on a prefix when looking up tuples whose length differs from the number of levels (GH 50293)
I/O#
read_csv()withengine="pyarrow"now raisesValueErrorfor the unsupportedencoding_errorswith bytes or file input instead of silently ignoring it (GH 71298)Bug in
DataFramerepr andDataFrame.to_string()where numeric column labels of differing widths were misaligned with their column’s values (GH 8300)Bug in
read_csv()silently misparsing non-ASCIIthousandsanddecimalmarkers with the C engine; these now fall back to the Python engine with aerrors.ParserWarning, or raiseValueErrorifengine="c"is explicitly specified (GH 71158)Bug in
read_csv()where adtypegiven for aparse_datescolumn undid the date parsing, returning strings, objects, integers or categories instead of datetimes (GH 57512)Bug in
read_csv()withengine="c"andcommentnot skipping a line containing only whitespace before the comment character (GH 55916)Bug in
read_csv()withengine="pyarrow"silently wrapping values outside the range of the requested integerdtypeinstead of raising (GH 38013)Bug in
read_csv()withengine="python"andindex_colreading a date like"20180101"as nanoseconds since the epoch whendtypeis a pyarrow timestamp dtype (GH 24542)Bug in
read_csv(),read_excel(),read_fwf()andread_html()returning wrong column labels and treating header rows as data whenheaderwas a list not in increasing order, such asheader=[1, 0](GH 47011)Bug in
read_csv(),DataFrame.to_csv()and other I/O functions raisingURLErrorforsftp://URLs instead of reading or writing them withfsspec(GH 46765)Bug in
read_excel()raisingValueErrorwhenheaderis a list andindex_colconsumes all columns (GH 66372)Bug in
read_html()raisingImportErrorwhenlxmlis not installed instead of falling back tobs4+html5libwith the defaultflavor=None(GH 30281)Bug in
read_html()with thebs4orhtml5libparser dropping tables that have identical content, so only the first was returned (GH 49934)Bug in
read_orc()raising wheneverfilesystemwas passed (GH 58746)Bug in
read_sas()exhausting memory instead of raisingValueErroron a SAS7BDAT file that claims more rows than it can hold, when read from an uncompressed file, a zip archive, or aBytesIO(GH 70721)Bug in
read_sas()returning rows that were deleted from an uncompressed SAS7BDAT file (GH 15963)Bug in
read_sas()withformat="xport"reading zeros as5.397605e-79(GH 50670)Bug in
DataFrame.to_csv()withMultiIndexcolumns and an unnamed index orindex_label=Falsewhere a first row of missing values was read back byread_csv()as the index names and dropped; an empty index-names line is now written in this case (GH 21995)Bug in
DataFrame.to_csv(),DataFrame.to_json(),DataFrame.to_pickle()and similar writers where writing to afile://URL raised for a new file and silently left an existing file unchanged; writing to other URLs such ashttp://now raises instead of silently discarding the data (GH 55828)Bug in
DataFrame.to_excel()where aNaNlabel inMultiIndexcolumns was written as the last value of that level instead of an empty cell (GH 62340)Bug in
DataFrame.to_json()andSeries.to_json()dropping the nanoseconds of tz-aware datetime columns andTimestampobjects, and withdate_format="epoch"mis-rounding pre-1970datetimeobjects or raisingOverflowErrorfor ones outside the nanosecond bounds at a coarserdate_unit(GH 53473)Bug in
DataFrame.to_parquet()withengine="pyarrow"where a misspelled keyword argument truncated an existing file at the destination or was reported as an error about the path (GH 45815)Bug in
DataFrame.to_sql()creating MySQL and MariaDB datetime and time columns that silently dropped fractional seconds (GH 48435)Bug in
DataFrame.to_sql()withif_exists="append"orif_exists="delete_rows"writing to an existing table hanging on SQL Server while another session had uncommitted changes to an unrelated table (GH 52601)Bug in
DataFrame.to_sql()withif_exists="delete_rows"raisingInvalidRequestErrorfor an existing temporary table (GH 52601)Bug in
DataFrame.to_stata()raisingValueErrorfor an empty DataFrame with a categorical column, andread_stata()not converting the column back to a categorical (GH 71126)Bug in
DataFrame.to_string(),Series.to_string()andDataFrame.to_html()ignoringna_repforNone,pd.NA, andNaTvalues in object-dtype columns and an explicitna_rep="NaN"for any missing value, and inDataFrame.to_xml()raising forna_repwith nullable, pyarrow-backed, or categorical columns containing missing values (GH 54872)Bug in
DataFrame.to_string(),Series.to_string()and theirreprwhere values or labels containing ANSI color codes were counted toward the column width, misaligning the other rows (GH 55122)Bug in displaying a
SeriesorDataFramein IPython withdisplay.html.table_schemaenabled printing a traceback when the data cannot be converted to JSON, such as non-UTF-8bytes(GH 16848)Bug in the display of a
MultiIndex(repr,DataFrame.to_string(),DataFrame.to_html(),Styler) where distinct labels that display identically (e.g.1and"1") were shown as a single label;DataFrame.to_excel()merged them into one cell, losing all but the first value (GH 10796)Bug in the repr of a
SeriesorDataFramewithlongdouble(e.g.float128) dtype showing values outside thefloat64range as0orinf(GH 17809)Fixed bug in
read_csv()where callableskiprowsreceived incorrect row numbers on 32-bit big-endian architectures (GH 69985)Bug in
ExcelWriterwithengine="openpyxl"ignoringdate_formatanddatetime_format(GH 44284, GH 59882)DataFrame.to_json()andSeries.to_json()withorient="table", andbuild_table_schema(), no longer raiseAttributeErrorfor aMultiIndexwith non-string level names (GH 19129)Bug in
read_csv()where usingengine="python"with customconvertersreturning unhashable types (such as lists or dicts) raisedTypeError(GH 56848)Bug in
read_json()withtyp="series"returningdatetime64dtype for all-null data instead offloat64, matchingDataFramecolumns (GH 35464)Bug in
read_sas()raisingIndexErroror reading the wrong format or label for SAS7BDAT files with columns renamed or relabeled after the file was written (GH 60809)Bug in
read_sql_query()andread_sql_table()with a SQLAlchemy connection returning column labels that requiresqlalchemyto unpickle (GH 52816)Bug in
HDFStore.append()raisingValueError: Buffer dtype mismatchinstead of the “different categories” error when appending a categorical whose categories have a different dtype than the existing ones (GH 71128)Bug in
HDFStore.remove()deleting unselected rows when passing unsorted row coordinates (GH 71276)Bug in
Series.to_json()withorient="table"writing a falsySeriesname such as0,Falseor""as"values"(GH 19129)Bug where the pickled bytes (e.g. for
joblib.hash) of aSeries,DataFrameorIndexwith datetimelike or extension-dtype data depended on which operations had previously been run on it (GH 49170)Fixed a segfault in
DataFrame.to_json()andSeries.to_json()withdate_format="iso"when datetime conversion raises an exception (GH 69461)
Period#
Bug in
PeriodIndexandarray()with a perioddtyperaising when given a list of nanosecond-unitnp.datetime64values, andPeriodIndexraisingAttributeErrorinstead ofValueErrorfordatetime64data without afreq(GH 70139)Bug in
Periodconstructor where the string of a weeklyPeriodsuch as"2011-12-26/2012-01-01"or"2000-01-03/2000-01-09"was silently parsed as a minute-frequencyPeriod(GH 48000)Bug in
Period,PeriodIndex,period_range()and casting toPeriodDtypesilently dropping the timezone of timezone-aware input; these now emit aUserWarninglikeTimestamp.to_period()(GH 47005)Bug in
Period.strftime()andPeriodIndex.strftime()where%Ywas not zero-padded for years before 1000 on Linux (GH 48746)
Plotting#
Bug in
plotting.table()ignoringrowLabelsandcolLabelsor raising aTypeErrorwhen they were passed (GH 37811)Bug in
DataFrame.hist()withbyand nocolumnplotting the numeric grouping column alongside the other columns (GH 41188)Bug in
DataFrame.plot()andSeries.plot()withkind="bar"orkind="barh"raisingTypeErrorontimedelta64data containingNaT(GH 39320)Bug in
DataFrame.plot()andSeries.plot()with aTimedeltaIndexthat has no regular frequency, or withx_compat=True, plotting the points evenly spaced and leaving most x-axis ticks unlabeled (GH 19965)Bug in
DataFrame.plot()andSeries.plot()with a regular-frequencyDatetimeIndexorPeriodIndexmislabeling ticks set withxticks=orax.set_xticks(GH 18881)Bug in
Series.plot()andDataFrame.plot()with a timezone-aware index raisingValueErrorwhen the first timestamp falls in a daylight saving time transition, e.g. the repeated hour of a fall-back day (GH 62936)
Groupby/resample/rolling#
Bug in
DataFrameGroupBy.cumsum(),DataFrameGroupBy.cummin(),DataFrameGroupBy.cummax(), andDataFrameGroupBy.rank()(and Series variants) ondatetime64,timedelta64, andPeriodDtypedata treatingNaTas a regular value and losing precision when the group key containsNA(GH 69923)Bug in
DataFrameGroupBy.cumsum(),DataFrameGroupBy.cumprod(),DataFrameGroupBy.cummin(),DataFrameGroupBy.cummax(), andDataFrameGroupBy.rank()raisingNotImplementedError, often with no message, instead ofTypeErroron columns that do not support them, e.g.objectcolumns andArrowDtypedate, time and binary columns (GH 69791)Bug in
DataFrameGroupBy.max(),DataFrameGroupBy.min(),DataFrameGroupBy.cummax(), andDataFrameGroupBy.cummin()(and Series variants) on nullable float data with thefuture.distinguish_nan_and_naoption enabled returninginfor-inffor all-NaNgroups and ignoringNaNin other groups;NaNnow propagates as inDataFrameGroupBy.sum(); under the default option,ArrowDtypefloat data containingNaNnow givesNAinstead of ignoring theNaN(GH 59106)Bug in
DataFrameGroupBy.resample()followed byResampler.aggregate()with a list of functions aggregating the grouping andoncolumns, raisingTypeErroror returning them as extra result columns (GH 32162)Bug in
DataFrameGroupBy.shift(),SeriesGroupBy.shift(),DataFrameGroupBy.diff(), andSeriesGroupBy.diff()withperiods=0not setting rows with an NA group key to missing (GH 70996)Bug in
DataFrameGroupBy.transform()with a function returning a scalar for each column casting the results to a common dtype (GH 42617)Bug in
GroupBy.median(),GroupBy.skew(), andGroupBy.kurt()oncomplexdata silently discarding the imaginary part; these now raiseTypeError(GH 43770)Bug in
GroupBy.quantile()raisingNotImplementedErrorwith no message, instead ofTypeError, onArrowDtypecolumns it does not support, e.g. binary columns (GH 69808)Bug in
GroupBy.std()andGroupBy.sem()oncomplexdata silently discarding the imaginary part, andGroupBy.var()raising; these now matchSeries.std(),Series.sem(), andSeries.var()(GH 43770)Bug in
SeriesGroupBy.transform()with a callable raising forSeriessubclasses that cannot hold the transformed values; the result now falls back to the type the subclass chooses (geopandas/geopandas#3059, GH 71165)Bug in
DataFrame.agg(),DataFrameGroupBy.agg(), and resample/rollingaggwith a dict, list, or named aggregation over more than 100 columns emitting a spuriousPerformanceWarningwithas_index=Falseor on a laterDataFrame.reset_index()(GH 61628)Bug in
DataFrame.groupby()andSeries.groupby()withsort=Trueanddropna=Falseplacing theNaNgroup in the middle of the result instead of last for object-dtype keys;Index.union()had the same misordering (GH 70216)Bug in
DataFrame.groupby(),DataFrame.resample(),DataFrame.rolling(),DataFrame.expanding(), andDataFrame.ewm()raisingTypeErrorwhen selectingMultiIndexcolumns with a tuple key (GH 13914)Bug in
Series.resample()andDataFrame.resample()with aPeriodIndexandclosed="right"returning shifted labels or incorrect aggregations (GH 44363)Bug in time-based
Rolling.cov()andRolling.corr()raisingValueErroror silently returning wrong results whenotherhas a different index; the result is now computed on the aligned index, as with integer windows. Withon, a mismatched index now raisesValueError(GH 62937)
Reshaping#
Bug in
concat()and theDataFrameconstructor losing thefreqof aDatetimeIndexorTimedeltaIndexdepending on the order of the inputs (GH 64253)Bug in
merge_asof()withright_index=Trueand an emptyleftreturning the index ofrightinstead ofleft(GH 41171)Bug in
merge()raisingValueErrorwhen merging a numeric key with anobjectkey that is not all strings, e.g.[1.5, None],[1.5, "a"], or an empty or all-missing key (GH 70218)Bug in
DataFrame.pivot()andpivot()with a list ofvaluescasting the pivoted columns to a common dtype, e.g. integers tofloat64orobject(GH 43547)Bug in
DataFrame.stack()where missing labels in the result’sMultiIndexcould not be found by lookups such as.loc; unstacking such a result now places the missing label first unlesssort=Falseis passed (GH 40366)
Sparse#
Bug in setting integer
SparseDtypevalues into an integerSeriesorIndex(__setitem__,.loc,.iloc,Series.where(),Series.mask(),Series.update(),Index.putmask()) raisingAttributeError: 'SparseDtype' object has no attribute 'itemsize'(GH 68457)
ExtensionArray#
Bug in
read_csv()and other parsing of strings into a decimalArrowDtyperaisingArrowInvalidinstead of parsing the values (GH 69838)Bug in
ArrowExtensionArray.factorize()ignoringuse_na_sentinel=Truefor dictionary-encoded PyArrow data that stores nulls as dictionary values, keeping the null in the returneduniquesor raisingArrowInvalidfor chunked data (GH 66490)Bug in
Series.isin(),DataFrame.isin(), andIndex.isin()on PyArrow-backed dtypes raising whenvaluesheld a mix of types PyArrow cannot combine (GH 70300)Bug in
Series.mode()andDataFrame.mode()withdropna=FalseraisingTypeErrorfor"boolean"dtype (GH 70487)Bug in
Series.replace(),Series.where(),Series.fillna(), item assignment and related methods on a PyArrow-backed integer dtype silently truncating a fractional value, including one passed in a list (replace(2, 1.5)stored1); these now raiseTypeError, whileIndex.where(),Index.putmask()andIndex.fillna()upcast, matching the nullable integer dtypes (GH 68638, GH 71076)Bug in arithmetic and logical operations on PyArrow-backed data raising
pyarrow.ArrowInvalidorpyarrow.ArrowTypeErrorinstead ofTypeErrorwhen the other operand contains objects PyArrow cannot convert (GH 62682)Bug in comparisons between PyArrow-backed data and objects PyArrow cannot convert raising
pyarrow.ArrowInvalidorpyarrow.ArrowTypeError;==/!=now compare elementwise, ordered comparisons raiseTypeError, and a missing value on either side propagates instead of answeringFalse(GH 62682)
Styler#
Bug in
Stylermethods taking alevelargument, such asStyler.hide()andStyler.format_index(), ignoring or raising on negative, out-of-range or NumPy integer levels;levelis now resolved as inDataFrame.droplevel(), so an integer matching a level name refers to that level (GH 42933)Bug in
Styler.background_gradient()andStyler.text_gradient()coloring missing values with the lowest colormap color instead of the missing-value color when all valid values in a column, row, or table were equal (GH 47695)Bug in
Styler.bar()raisingTypeErrorfor data containingpd.NAwhenalignis"mean"or a callable, or whencmapis given (GH 56425)Bug in
Styler.map(),Styler.apply()andStyler.set_table_styles()truncating CSS values that contain a;inside quotes or parentheses, such asurl("data:image/png;base64,...")(GH 59623)Bug in
Styler.to_excel()applying styles to the wrong columns whencolumnsselects or reorders columns (GH 42276)Bug in
Styler.to_html()where Chrome and other Chromium-based browsers did not apply a style shared by more than 8192 cells to the cells beyond the first 8192 (GH 40913)
Other#
Bug in
api.interchange.from_dataframe()withallow_copy=Falsealways raisingRuntimeErrorfor objects supporting the Arrow PyCapsule Interface, even when a zero-copy conversion is possible (GH 71189)Bug in
eval()with a multi-line expression and atargetraisingUndefinedVariableErrorwhen a line after the first referenced a variable (GH 31952)Bug in
eval(),DataFrame.eval()andDataFrame.query()wherenotperformed a bitwise inversion instead of a logical negation, e.g.pd.eval("not True")returned-2anddf.query("a > 1 and not True")could return rows (GH 11367)Bug in
testing.assert_series_equal()andtesting.assert_frame_equal()withcheck_dtype=Falseandcheck_exact=Truecomparing missing values against an object column differently fromcheck_exact=False;pd.NAandNaTno longer matchnp.nanorNone(GH 61473)Bug in
util.hash_array()andutil.hash_pandas_object()raisingUnicodeDecodeErroron mixed-type object values containing non-ASCIIbytes;bytesin mixed-type values now hash the same as in non-mixed ones (GH 27215)Bug in
DataFrame.agg(),Series.agg()and theaggmethods of groupby, resample and window objects silently ignoring*argsand**kwargswhenfuncis a dict, e.g.df.agg({"a": "sum"}, min_count=1); they are now passed to each function, as with a list of functions, so a function that does not accept them now raisesTypeError(GH 23889)Bug in
DataFrame.duplicated()andDataFrame.drop_duplicates()raisingValueErrorwhensubsetis an empty list; no rows are now marked as duplicates, matching aDataFramewith no columns (GH 12869)Bug in
DataFrame.eval()andDataFrame.query()withengine="numexpr"where a column used again in a later line of a multi-line expression, or after a subscript such asa[a > 0], was treated as a NumPy array, raisingTypeErroror silently giving wrong results;eval()also no longer replaces the values of a passedresolversmapping with NumPy arrays (GH 59062)Bug in
DataFrame.eval(),DataFrame.query(), andeval()with the defaultengine="numexpr"raisingRecursionErrorfor arithmetic between object or string columns (e.g."a + b"on two string columns) andValueErrorfor an expression that is a single object or string column (GH 21088, GH 27639)Bug in
DataFrame.from_dict()withorient="index"silently setting a row’s values toNaNwhen its tuple key containedNoneorNaN(GH 28390)Bug in
DataFrame.query()andDataFrame.eval()where==and!=against a string gave different results than the same comparison outside ofquery, e.g. returning no rows for adatetime64,timedelta64, orPeriodDtypecolumn, or raisingNotImplementedErrorwithparser="python"(GH 54199)Bug in
DataFrame.query()andDataFrame.eval()where a column namedinforInfwas ignored in favor ofnp.inf, raisingKeyErroror silently returning wrong results (GH 47859)Bug in
DataFrame.query()andDataFrame.eval()withengine="numexpr"raisingAttributeErrorfor some comparisons andin/not inchecks whose operand is a math function or unary operator, e.g.abs(a) in [1, 2](GH 31848)Bug in calling a generalized ufunc on a
SeriesraisingAttributeErrorwhen it reducedobjectdata to a single object pandas does not recognize as a scalar, e.g.shapely.geometrycollectionsreturning a geometry (GH 71109)Bug in
eval(),DataFrame.eval(), andDataFrame.query()raising on somedatetime64andtimedelta64operations, e.g.df.query("time > @now - @delta"), and returningfloat32for afloat32column times anp.timedelta64(GH 30729, GH 52559)Bug in
DataFrame.replace()andSeries.replace()withinplace=Trueand a list-like or dictto_replaceusing memory proportional to the number of values to replace times the length of the data, raisingMemoryErrorfor large mappings (GH 25816)
Contributors#
A total of 61 people contributed patches to this release. People with a “+” by their names contributed a patch for the first time.
ASWANTH R +
Aahan G +
Aarya +
Aarya Prakash +
Aarya2004 +
Abhishek Kumar +
Aidan Feldman
Ammar Hassona +
Aniruktha +
Anushka Dudhe +
Atik +
Ayush Kumar +
Ayush Srivastava +
Breno Barreto +
Chaimaa Abi +
DeviousCardi +
Fangchen Li
Furqan Khan +
GON +
Gore Williams +
H23 +
Ishaan
Itssubhraneelbruv +
Johnny Kao +
Johnny Wilson Dougherty +
Joris Van den Bossche
Juan Miguel Contreras +
Julian Harbeck
Leo Camus +
Likhitha J +
Maha Rana Yadavalli +
Maha Yadavalli +
Mannava Daasaradhi +
Manvi Soni +
Matthew Roeschke
Minh Tuan Pham +
Mohd Maaz Khan +
N3verm1nd
Natalia Mokeeva
Odysseas Yiakoumis +
Parman Mohammadalizadeh +
Richard Shadrach
Ryan George +
S.A +
Saihritesh
SamuelOndrus +
Sugandh Garg +
TensorDevLJ +
Tiereonna +
Trinh Quoc Anh
Trupti603 +
Vincent Ngo +
Weijian He +
britz +
furqankhan +
guptaishaan
jbrockmendel
maharanay22 +
ump45nose
yuchen-xu +
Álvaro Kothe