Pandas-2-2-中文文档-四十一-
Pandas 2.2 中文文档(四十一)
2.1.4 新特性(2023 年 12 月 8 日)
这些是 pandas 2.1.4 中的更改。请参阅发行说明以获取包括 pandas 的其他版本在内的完整更改日志。
回归修复
-
修复了从 pandas 1.3 读取一个被 pickled 的 pandas
DataFrame时的回归错误 (GH 55137) ## Bug 修复 -
当
index是Series列表时,Series构造函数引发 DeprecationWarning 的错误 (GH 55228) -
当尝试将日期类似的字符串输入转换为
ArrowDtype的pyarrow.timestamp时,Series中的错误 (GH 56266) -
使用
ts_input="now"或ts_input="today"构建Timestamp时,与Timestamp.now()或Timestamp.today()给出的单位不同的错误 (GH 55879) -
Index.__getitem__()中的错误,对于 Arrow 数据类型和负步长返回错误的结果(GH 55832) -
当
infer_string选项设置时,修复了read_csv()中不尊重对象数据类型的错误 (GH 56047) -
修复了
to_numeric()中的错误,将string[pyarrow_numpy]数据类型转换为扩展数据类型 (GH 56179) -
修复了
DataFrameGroupBy.min()和DataFrameGroupBy.max()中不保留空对象的扩展数据类型的错误 (GH 55619) -
当
infer_string选项设置时,修复了DataFrame.__setitem__()中将带有对象数据类型的Index转换为 PyArrow 后端字符串的错误 (GH 55638) -
修复了
DataFrame.to_hdf()中的错误,当列具有StringDtype时引发异常 (GH 55088) -
修复了
Index.insert()中的错误,在设置infer_string选项时将对象数据类型转换为 PyArrow 支持的字符串 (GH 55638) -
修复了
Series.__ne__()中的错误,导致dtype="string[pyarrow_numpy]"的NA与字符串值的比较结果为 False (GH 56122) -
修复了
Series.mode()中的错误,当设置infer_string时未保留对象数据类型 (GH 56183) -
修复了
Series.reset_index()中的错误,当设置infer_string时未保留对象数据类型 (GH 56160) -
修复了
Series.str.split()和Series.str.rsplit()中的错误,当pat=None时对带有pyarrow.string的ArrowDtype(GH 56271) -
修复了
Series.str.translate()中的错误,在设置字符串选项时丢失对象数据类型 (GH 56152) ## 贡献者
本次发布共有 12 人贡献了补丁。名字后带有“+”符号的人是首次贡献补丁的。
-
Daniel Isaac
-
Joris Van den Bossche
-
Luke Manley
-
Lumberbot(又名 Jack)
-
Marco Edward Gorelli
-
Matthew Roeschke
-
Pandas 开发团队
-
Patrick Hoefler
-
Thomas Li
-
William Ayd
-
Yao Xiao
-
pre-commit-ci[bot] ## 修复的回归
-
修复了从 pandas 1.3 读取序列化的 pandas
DataFrame时出现的回归错误 (GH 55137)
Bug 修复
-
在
Series构造函数中修复了当index是Series列表时引发 DeprecationWarning 的错误 (GH 55228) -
当尝试将日期类似的字符串输入转换为
pyarrow.timestamp的ArrowDtype时,Series中的 bug(GH 56266) -
使用
ts_input="now"或ts_input="today"构造Timestamp时的 bug,与Timestamp.now()或Timestamp.today()给出的单位不同(GH 55879) -
Index.__getitem__()中的 bug 返回了 Arrow dtypes 和负步长的错误结果(GH 55832) -
修复了
read_csv()中的 bug,在设置infer_string选项时未尊重对象 dtype(GH 56047) -
修复了
to_numeric()中的 bug,将string[pyarrow_numpy]dtype 转换为扩展 dtype(GH 56179) -
修复了
DataFrameGroupBy.min()和DataFrameGroupBy.max()在空对象时未保留扩展 dtype 的 bug(GH 55619) -
修复了
DataFrame.__setitem__()中的 bug,在设置infer_string选项时将具有对象 dtype 的Index转换为 PyArrow 支持的字符串(GH 55638) -
修复了
DataFrame.to_hdf()中的 bug,在列具有StringDtype时引发错误(GH 55088) -
修复了
Index.insert()中的 bug,在设置infer_string选项时将对象 dtype 转换为 PyArrow 支持的字符串(GH 55638) -
Series.__ne__()中的 bug 修复,导致dtype="string[pyarrow_numpy]"的NA与字符串值比较时结果为 False(GH 56122) -
修复了
Series.mode()在设置infer_string时未保持对象数据类型的错误(GH 56183) -
修复了
Series.reset_index()在设置infer_string时未保留对象数据类型的错误(GH 56160) -
修复了
Series.str.split()和Series.str.rsplit()在对带有pyarrow.string的ArrowDtype使用pat=None时的错误(GH 56271) -
修复了
Series.str.translate()在设置字符串选项时丢失对象数据类型的错误(GH 56152)
贡献者
共有 12 人为此版本提供了补丁。带有“+”标记的人第一次贡献了补丁。
-
丹尼尔·艾萨克
-
乔里斯·范丹·博斯
-
卢克·曼利
-
伐木机器人(又名杰克)
-
马尔科·爱德华·戈雷利
-
马修·罗斯克
-
Pandas 开发团队
-
帕特里克·霍夫勒
-
托马斯·李
-
威廉·艾德
-
姚晓
-
pre-commit-ci[bot]
2.1.3 版本新功能(2023 年 11 月 10 日)
这些是 pandas 2.1.3 版本的变化。请参阅发布说明以获取包括其他版本在内的完整更改日志。
修复的回归问题
-
修复了某些 DataFrame 子类上返回新对象的操作导致的无限递归(GH 55763) ## Bug 修复
-
修复了
DatetimeIndex.diff()引发TypeError的错误(GH 55080) -
修复了
Index.isin()在 Arrow 支持的字符串和None值时引发的错误(GH 55821) -
修复了
read_parquet()和read_feather()中的 CVE-2023-47248(GH 55894) ## 贡献者
总共有 11 人为这个版本贡献了补丁。名字后面带有“+”的人是首次贡献补丁的。
-
艾萨克·维尔舒普
-
乔里斯·范登博斯
-
卢克·曼利
-
木材机器人(又名杰克)
-
Marco Edward Gorelli
-
MarcoGorelli
-
马修·罗斯克
-
Pandas 开发团队
-
托马斯·李
-
威廉·艾德
-
钴 + ## 修复的回归问题
-
修复了某些 DataFrame 子类上返回新对象的操作导致的无限递归(GH 55763)
Bug 修复
-
修复了
DatetimeIndex.diff()引发TypeError的错误(GH 55080) -
修复了
Index.isin()在 Arrow 支持的字符串和None值时引发的错误(GH 55821) -
修复了
read_parquet()和read_feather()中的 CVE-2023-47248(GH 55894)
贡献者
总共有 11 人为这个版本贡献了补丁。名字后面带有“+”的人是首次贡献补丁的。
-
艾萨克·维尔舒普
-
乔里斯·范登博斯
-
卢克·曼利
-
木材机器人(又名杰克)
-
Marco Edward Gorelli
-
MarcoGorelli
-
马修·罗斯克
-
Pandas 开发团队
-
托马斯·李
-
威廉·艾德
-
钴 +
2.1.2 版本的新功能(2023 年 10 月 26 日)
这些是 pandas 2.1.2 中的更改。查看发布说明以获取包括其他版本的 pandas 在内的完整更改日志。
弃用
-
撤销了在
DataFrame.pct_change()、Series.pct_change()、DataFrameGroupBy.pct_change()和SeriesGroupBy.pct_change()中fill_method=None的弃用;值'backfill'、'bfill'、'pad'和'ffill'仍然被弃用(GH 53491) ## 修复的回归问题 -
修复了
DataFrame.join()中的回归问题,结果缺少值且 dtype 为 arrow backed string 时(GH 55348) -
修复了
rolling()中的回归问题,其中非纳秒索引或on列会产生不正确的结果(GH 55026, GH 55106, GH 55299) -
修复了
DataFrame.resample()中的回归问题,当origin超出其边界时,会向后外推到origin(GH 55064) -
修复了
DataFrame.sort_index()中的回归问题,当索引是切片的MultiIndex时,排序不正确(GH 55379) -
修复了
DataFrameGroupBy.agg()和SeriesGroupBy.agg()中的回归问题,��果选项compute.use_numba设置为 True,则不受 numba 引擎支持的 groupby 方法会引发TypeError(GH 55520) -
修复了宽 DataFrame 的性能回归问题,通常涉及访问所有列的方法时,会单独访问每一列(GH 55256, GH 55245)
-
修复了
merge_asof()中的回归问题,对于具有日期时间和时间间隔数据类型的by引发TypeError(GH 55453) -
修复了
read_parquet()在读取包含超过 2 GB 字符串数据的字符串列文件并使用"string"数据类型时的回归错误 (GH 55606) -
修复了在使用
detect_types时,DataFrame.to_sql()在 sqlite 中未正确往返 datetime 列的回归错误 (GH 55554) -
修复了某些 DataFrame 或 Series 子类构造中的回归错误 (GH 54922) ## Bug 修复
-
修复了当设置
infer_string时DataFrameGroupBy缩减未保留对象数据类型的错误 (GH 55620) -
修复了
SeriesGroupBy.value_counts()在返回字符串列时返回错误的数据类型的错误(GH 55627) -
修复了如果其他对象具有箭头支持的字符串数据类型,则
Categorical.equals()的错误 (GH 55364) -
修复了
DataFrame.__setitem__()在使用infer_string=True时不会为零维数组推断字符串数据类型的错误 (GH 55366) -
修复了
DataFrame.idxmin()和DataFrame.idxmax()在箭头数据类型时引发的错误 (GH 55368) -
修复了
DataFrame.interpolate()引发不正确错误消息的错误 (GH 55347) -
修复了
Index.insert()在将None插入具有dtype="string[pyarrow_numpy]"的Index时引发的错误 (GH 55365) -
修复了
Series.all()和Series.any()在dtype="string[pyarrow_numpy]"时未正确处理缺失值的错误 (GH 55367) -
修复了
Series.floordiv()中的错误,针对ArrowDtype(GH 55561) -
修复了
Series.mode()中 arrow 支持的字符串 dtype 未排序值的错误(GH 55621) -
修复了
Series.rank()中string[pyarrow_numpy]dtype 的错误(GH 55362) -
修复了
Series.str.extractall()中的错误,因为ArrowDtypedtype 被转换为 object(GH 53846) -
修复了创建新条件列时显示 PDEP-6 警告(关于设置不兼容 dtype��项)的错误(GH 55025)
-
修复了
Series构造函数在NA是第一个值且infer_string被设置时未推断出字符串 dtype 的错误(:issue:55655) ## 其他 -
修复了可选依赖组
output_formatting的安装失败。用破折号-替换下划线_可以修复依赖关系解析失败的问题。现在正确的使用方式是pip install pandas[output-formatting]。 ## 贡献者
总共有 20 人为这个版本贡献了补丁。名字后面带有“+”的人是第一次贡献补丁。
-
Amanda Bizzinotto
-
Artur Barseghyan +
-
Hadi Abdi Khojasteh +
-
Joris Van den Bossche
-
Luke Manley
-
Lumberbot(又名 Jack)
-
Marc Garcia
-
Marco Edward Gorelli
-
MarcoGorelli
-
Mateusz Sokół
-
Matthew Roeschke
-
Natalia Mokeeva
-
Pandas 开发团队
-
Patrick Hoefler
-
Richard Shadrach
-
Thomas Li
-
Yao Xiao
-
dependabot[bot]
-
rohanjain101 +
-
torext + ## 弃用
-
撤销了在
DataFrame.pct_change()、Series.pct_change()、DataFrameGroupBy.pct_change()和SeriesGroupBy.pct_change()中fill_method=None的弃用;值'backfill'、'bfill'、'pad'和'ffill'仍然被弃用(GH 53491)
修复的回归
-
修复了
DataFrame.join()中的回归问题,其中结果具有缺失值且 dtype 是 arrow 支持的字符串类型(GH 55348) -
修复了
rolling()中的回归问题,其中非纳秒索引或on列会产生不正确的结果(GH 55026,GH 55106,GH 55299) -
修复了
DataFrame.resample()中的回归问题,当origin超出其界限时会向后外推origin(GH 55064) -
修复了
DataFrame.sort_index()中的回归问题,在索引为切片的情况下未正确排序MultiIndex(GH 55379) -
修复了
DataFrameGroupBy.agg()和SeriesGroupBy.agg()中的回归问题,当选项compute.use_numba设置为 True 时,不受 numba 引擎支持的 groupby 方法会引发TypeError(GH 55520) -
修复了在
merge_asof()中的回归问题,对于具有日期时间和时间间隔 dtype 的by会引发TypeError(GH 55453) -
修复了在使用
"string"dtype 时读取具有超过 2 GB 字符串数据的文件时的read_parquet()中的回归问题(GH 55606) -
修复了
DataFrame.to_sql()中的回归问题,在使用detect_types时,sqlite 的 datetime 列未正确回环(GH 55554) -
修复了某些 DataFrame 或 Series 子类构造中的回归问题(GH 54922)
Bug 修复
-
修复了
DataFrameGroupBy规约时当infer_string设置时未保留对象 dtype 的回归问题(GH 55620) -
修复了
SeriesGroupBy.value_counts()中的错误,为字符串列返回了不正确的数据类型(GH 55627) -
修复了
Categorical.equals()中的错误,如果其他数据具���arrow 支持的字符串数据类型(GH 55364) -
修复了
DataFrame.__setitem__()中的错误,对于使用infer_string=True的零维数组未推断出字符串数据类型(GH 55366) -
修复了
DataFrame.idxmin()和DataFrame.idxmax()中的错误,对于 arrow 数据类型引发异常(GH 55368) -
修复了
DataFrame.interpolate()中的错误,引发了不正确的错误消息(GH 55347) -
修复了
Index.insert()中的错误,当将None插入到带有dtype="string[pyarrow_numpy]"的Index时引发异常(GH 55365) -
修复了
Series.all()和Series.any()中的错误,对于dtype="string[pyarrow_numpy]"未正确处理缺失值(GH 55367) -
修复了
Series.floordiv()中的错误,适用于ArrowDtype(GH 55561) -
修复了
Series.mode()中的错误,对于 arrow 支持的字符串数据类型未对值进行排序(GH 55621) -
修复了
Series.rank()中的错误,适用于string[pyarrow_numpy]数据类型(GH 55362) -
修复了
Series.str.extractall()中的错误,适用于被转换为对象的ArrowDtype数据类型(GH 53846) -
修复了创建新的条件列时出现 PDEP-6 警告的 bug,该警告是关于设置不兼容 dtype 的项时显示的(GH 55025)
-
修复了
Series构造函数在NA是第一个值且infer_string被设置时没有推断出字符串 dtype 的 bug(:issue:55655)
其他
- 修复了可选依赖组
output_formatting安装失败的问题。将下划线_替换为破折号-可以修复依赖解析错误的问题。现在的正确用法是pip install pandas[output-formatting]。
贡献者
共有 20 人为此版本提交了补丁。名字后面带有“+”符号的人第一次贡献了补丁。
-
Amanda Bizzinotto
-
Artur Barseghyan +
-
Hadi Abdi Khojasteh +
-
Joris Van den Bossche
-
Luke Manley
-
木材机器人(又名 Jack)
-
Marc Garcia
-
Marco Edward Gorelli
-
MarcoGorelli
-
Mateusz Sokół
-
Matthew Roeschke
-
Natalia Mokeeva
-
Pandas 开发团队
-
Patrick Hoefler
-
Richard Shadrach
-
Thomas Li
-
Yao Xiao
-
dependabot[bot]
-
rohanjain101 +
-
torext +
2.1.1 版中的新功能(2023 年 9 月 20 日)
这些是 pandas 2.1.1 版中的更改。详见发布说明以获取包括其他版本的完整更改日志。
修复的回归问题
-
修复了
concat()在DataFrame具有两种不同扩展 dtype 时的回归问题 (GH 54848) -
修复了
merge()在合并 PyArrow 字符串索引时的回归问题 (GH 54894) -
修复了
read_csv()在给定usecols和dtypes为engine="python"的字典时的回归问题 (GH 54868) -
修复了
read_csv()在delim_whitespace为 True 时的回归问题(GH 54918, GH 54931) -
修复了
GroupBy.get_group()在axis=1时引发的回归问题 (GH 54858) -
修复了
DataFrame.__setitem__()在设置带有部分MultiIndex的Series时引发AssertionError的回归问题 (GH 54875) -
修复了
DataFrame.filter()不遵守filter元素顺序的回归问题 (GH 54980) -
修复了
DataFrame.to_sql()在 sqlite 中未正确往返 datetime 列的回归问题 (GH 54877) -
修复了
DataFrameGroupBy.agg()在使用字典聚合具有重复列名的 DataFrame 时的回归问题 (GH 55006) -
修复了
MultiIndex.append()在附加重叠的IntervalIndex级别时引发的回归问题 (GH 54934) -
修复了
Series.drop_duplicates()在 PyArrow 字符串中的回归问题(GH 54904) -
修复了
Series.interpolate()在给定fill_value时引发的回归问题(GH 54920) -
修复了
Series.value_counts()在指定bins时对数值数据引发的回归问题(GH 54857) -
修复了 PyArrow 支持的列的比较操作中未正确传播异常的回归问题(GH 54944)
-
修复了将具有
datetime64dtype 的Series与None进行比较时的回归问题(GH 54870) ## Bug 修复 -
修复了
ArrowDtype在固定大小列表中引发NotImplementedError的错误(GH 55000) -
修复了带有
future_stack=True和由元组组成的非MultiIndex列的DataFrame.stack()中的错误(GH 54948) -
修复了
Series.dt.tz()在具有ArrowDtype的情况下返回字符串而不是tzinfo对象的错误(GH 55003) -
修复了
Series.pct_change()和DataFrame.pct_change()显示不必要的FutureWarning的错误(GH 54981) ## 其他 -
撤销了不允许
Series.apply()在传入的可调用函数返回Series对象时返回DataFrame的弃用(GH 52116) ## 贡献者
本次发布共有 13 人贡献了补丁。带有“+”标记的人是第一次贡献补丁的。
-
Ben Greiner +
-
Joris Van den Bossche
-
Kai Mühlbauer +
-
Luke Manley
-
Lumberbot(又名 Jack)
-
Mateusz Sokół
-
Matthew Roeschke
-
Pandas 开发团队
-
Patrick Hoefler
-
Rajat Subhra Mukherjee
-
Ralf Gommers
-
Richard Shadrach
-
Thomas Li ## 修复的回归问题
-
当
DataFrame具有两种不同的扩展 dtype 时,在concat()中修复了回归问题(GH 54848) -
在
merge()中修复了 PyArrow 字符串索引合并时的回归问题(GH 54894) -
当
usecols给定且dtypes为engine="python"的字典时,在read_csv()中修复了回归问题(GH 54868) -
当
delim_whitespace为 True 时,在read_csv()中修复了回归问题(GH 54918, GH 54931) -
在
axis=1时,修复了GroupBy.get_group()引发的回归问题(GH 54858) -
在设置带有部分
MultiIndex的Series时,修复了DataFrame.__setitem__()引发AssertionError的回归问题(GH 54875) -
在
filter时,修复了DataFrame.filter()不遵守元素顺序的回归问题(GH 54980) -
在 sqlite 中正确地回路 datetime 列时,在
DataFrame.to_sql()中修复了回归问题(GH 54877) -
在使用字典时,通过字典聚合具有重复列名的 DataFrame 时,修复了
DataFrameGroupBy.agg()引发的回归问题(GH 55006) -
在追加重叠的
IntervalIndex级别时,修复了MultiIndex.append()引发的回归问题(GH 54934) -
修复了 PyArrow 字符串在
Series.drop_duplicates()中的回归问题(GH 54904) -
修复了在指定
fill_value时Series.interpolate()引发错误的回归问题(GH 54920) -
修复了
Series.value_counts()在指定bins时对数值数据引发错误的回归问题(GH 54857) -
修复了 PyArrow 支持的列在比较操作中出现回归问题,未正确传播异常(GH 54944)
-
在将
Series与datetime64dtype 与None进行比较时出现回归问题的修复(GH 54870)
Bug 修复
-
修复了
ArrowDtype在固定大小列表中引发NotImplementedError的错误(GH 55000) -
修复了使用
future_stack=True和列为元组的非MultiIndex时DataFrame.stack()的错误(GH 54948) -
修复了在使用
ArrowDtype时Series.dt.tz()中返回字符串而不是tzinfo对象的错误(GH 55003) -
修复了
Series.pct_change()和DataFrame.pct_change()中显示不必要的FutureWarning的错误(GH 54981)
其他
- 撤销了不允许
Series.apply()在传入的可调用对象返回Series对象时返回DataFrame的弃用功能(GH 52116)
贡献者
总共有 13 人为这个版本贡献了补丁。名字后面带有“+”符号的人是第一次贡献补丁。
-
Ben Greiner +
-
Joris Van den Bossche
-
Kai Mühlbauer +
-
Luke Manley
-
Lumberbot(又名杰克)
-
Mateusz Sokół
-
Matthew Roeschke
-
Pandas 开发团队
-
Patrick Hoefler
-
Rajat Subhra Mukherjee
-
Ralf Gommers
-
Richard Shadrach
-
Thomas Li
2.1.0 中的新功能(2023 年 8 月 30 日)
这些是 pandas 2.1.0 中的更改。查看发布说明以获取包括其他版本的 pandas 在内的完整更改日志。
增强功能
PyArrow 将成为 pandas 3.0 的必需依赖项
PyArrow 将从 pandas 3.0 开始成为 pandas 的必需依赖项。这个决定是基于 PDEP 10做出的。
这将使更多对 pandas 用户极其有益的更改成为可能,包括但不限于:
-
默认情况下推断字符串为 PyArrow 支持的字符串,可以显著减少内存占用并获得巨大的性能改进。
-
默认情况下使用 PyArrow 推断更复杂的 dtypes,如
Decimal、lists、bytes、structured data等。 -
与依赖于 Apache Arrow 的其他库更好地互操作。
我们正在收集有关此决定的反馈 此处。### 默认情况下避免使用 NumPy 对象 dtype 存储字符串
以前,默认情况下,所有字符串都存储在具有 NumPy 对象 dtype 的列中。此版本引入了一个选项 future.infer_string,将所有字符串推断为 PyArrow 支持的字符串,dtype 为 "string[pyarrow_numpy]"。这是一种新的字符串 dtype 实现,遵循 NumPy 在比较操作中的语义,并将 np.nan 作为缺失值指示符。设置该选项还将推断 dtype "string" 为 StringDtype,存储设置为 "pyarrow_numpy",忽略选项 mode.string_storage 后面的值。
该选项仅在安装了 PyArrow 时才有效。与 NumPy 对象相比,PyArrow 支持的字符串具有显著减少的内存占用,并为用户提供了大幅度的性能改进(GH 54430)。
可以通过以下方式启用该选项:
pd.options.future.infer_string = True
这种行为将在 pandas 3.0 中成为默认行为。### DataFrame reductions preserve extension dtypes
在之前的 pandas 版本中,DataFrame reductions(DataFrame.sum() DataFrame.mean() 等)的结果具有 NumPy dtypes,即使 DataFrame 是扩展 dtypes。现在,Pandas 可以在对具有共同 dtype 的 DataFrame 列进行减少时保留 dtypes(GH 52788)。
旧行为
In [1]: df = pd.DataFrame({"a": [1, 1, 2, 1], "b": [np.nan, 2.0, 3.0, 4.0]}, dtype="Int64")
In [2]: df.sum()
Out[2]:
a 5
b 9
dtype: int64
In [3]: df = df.astype("int64[pyarrow]")
In [4]: df.sum()
Out[4]:
a 5
b 9
dtype: int64
新行为
In [1]: df = pd.DataFrame({"a": [1, 1, 2, 1], "b": [np.nan, 2.0, 3.0, 4.0]}, dtype="Int64")
In [2]: df.sum()
Out[2]:
a 5
b 9
dtype: Int64
In [3]: df = df.astype("int64[pyarrow]")
In [4]: df.sum()
Out[4]:
a 5
b 9
dtype: int64[pyarrow]
请注意,dtype 现在分别是掩码 dtype 和 PyArrow dtype,而以前是 NumPy 整数 dtype。
为了允许 DataFrame 缩减保留扩展 dtypes,ExtensionArray._reduce() 增加了一个新的关键字参数 keepdims。调用 ExtensionArray._reduce() 时,keepdims=True 应该沿着缩减轴返回长度为 1 的数组。为了保持向后兼容性,该参数不是必需的,但将来可能会变为必需。如果在签名中找不到该参数,则 DataFrame 缩减将无法保留扩展 dtypes。此外,如果找不到该参数,将会发出 FutureWarning,并且像 mypy 这样的类型检查器可能会抱怨签名与 ExtensionArray._reduce() 不兼容。 ### 写时复制改进
-
当
func修改Series时,Series.transform()不尊重写时复制 (GH 53747) -
调用
Index.values()现在将返回一个只读的 NumPy 数组 (GH 53704) -
将
Series设置到DataFrame中现在会创建一个惰性副本而不是深度副本 (GH 53142) -
当从 Index 对象字典构造 DataFrame 并指定
copy=False时,DataFrame构造函数现在将使用这些 Index 对象的惰性副本作为 DataFrame 的列 (GH 52947) -
对于 Series 或 DataFrame 的浅复制 (
df.copy(deep=False)) 现在也会返回行/列Index对象的浅复制,而不仅仅是数据的浅复制,即结果的索引不再相同 (df.copy(deep=False).index is df.index不再为 True) (GH 53721) -
DataFrame.head()和DataFrame.tail()现在将返回深拷贝(GH 54011) -
为
DataFrame.eval()添加延迟复制机制(GH 53746) -
当尝试在临时列选择上进行就地操作时(例如,
df["a"].fillna(100, inplace=True)),当启用写时复制时,将始终发出警告。在这种模式下,像这样就地操作永远不起作用,因为该选择行为类似于临时副本。这对以下操作也适用:-
DataFrame.update/Series.update -
DataFrame.fillna/Series.fillna -
DataFrame.replace/Series.replace -
DataFrame.clip/Series.clip -
DataFrame.where/Series.where -
DataFrame.mask/Series.mask -
DataFrame.interpolate/Series.interpolate -
DataFrame.ffill/Series.ffill -
DataFrame.bfill/Series.bfill### 新DataFrame.map()方法和对 ExtensionArrays 的支持
-
DataFrame.map() 方法已添加,DataFrame.applymap() 已被弃用。DataFrame.map() 具有与 DataFrame.applymap() 相同的功能,但新名称更好地传达了这是 DataFrame 版本的 Series.map() (GH 52353).
给定一个可调用对象时,Series.map() 将该可调用对象应用于Series 的所有元素。类似地,DataFrame.map() 将该可调用对象应用于DataFrame 的所有元素,而 Index.map() 将该可调用对象应用于Index 的所有元素。
经常情况下,不希望将可调用对象应用于数组的类似 nan 的值,并且为了避免这样做,可以使用na_action="ignore"调用map方法,即ser.map(func, na_action="ignore")。但是,na_action="ignore"没有为许多ExtensionArray和Index类型实现,并且除了可空数值类型(即 dtype 为Int64等)之外,na_action="ignore"对任何ExtensionArray子类都不起作用。
na_action="ignore"现在适用于所有数组类型(GH 52219,GH 51645,GH 51809,GH 51936,GH 52033;GH 52096)。
先前的行为:
In [1]: ser = pd.Series(["a", "b", np.nan], dtype="category")
In [2]: ser.map(str.upper, na_action="ignore")
NotImplementedError
In [3]: df = pd.DataFrame(ser)
In [4]: df.applymap(str.upper, na_action="ignore") # worked for DataFrame
0
0 A
1 B
2 NaN
In [5]: idx = pd.Index(ser)
In [6]: idx.map(str.upper, na_action="ignore")
TypeError: CategoricalIndex.map() got an unexpected keyword argument 'na_action'
新行为:
In [5]: ser = pd.Series(["a", "b", np.nan], dtype="category")
In [6]: ser.map(str.upper, na_action="ignore")
Out[6]:
0 A
1 B
2 NaN
dtype: category
Categories (2, object): ['A', 'B']
In [7]: df = pd.DataFrame(ser)
In [8]: df.map(str.upper, na_action="ignore")
Out[8]:
0
0 A
1 B
2 NaN
In [9]: idx = pd.Index(ser)
In [10]: idx.map(str.upper, na_action="ignore")
Out[10]: CategoricalIndex(['A', 'B', nan], categories=['A', 'B'], ordered=False, dtype='category')
另外,请注意,Categorical.map()的na_action隐式地默认设置为"ignore"。这已经被弃用,Categorical.map()的默认值将更改为na_action=None,与所有其他数组类型一致。### DataFrame.stack()的新实现
pandas 已重新实现了DataFrame.stack()。要使用新实现,请传递参数future_stack=True。这将成为 pandas 3.0 中唯一的选项。
先前的实现有两个主要的行为缺点。
-
先前的实现会不必要地在结果中引入 NA 值。用户可以通过传递
dropna=True(默认值)来自动删除 NA 值,但这样做也可能会从结果中删除存在于输入中的 NA 值。请参见下面的示例。 -
先前的实现中带有
sort=True(默认值)的情况下,有时会对结果索引的一部分进行排序,有时不会。如果输入的列不是MultiIndex,则结果索引永远不会被排序。如果列是MultiIndex,则在大多数情况下,来自堆叠列级别的结果索引的级别将被排序。在某些罕见的情况下,这些级别将按非标准顺序排序,具体取决于如何创建列。
新的实现(future_stack=True)在堆叠多个级别时不再无必要地引入 NA 值,并且永远不会排序。因此,在使用 future_stack=True 时,参数 dropna 和 sort 不会被使用,必须保持未指定。这些参数将在下一个主要版本中被删除。
In [11]: columns = pd.MultiIndex.from_tuples([("B", "d"), ("A", "c")])
In [12]: df = pd.DataFrame([[0, 2], [1, 3]], index=["z", "y"], columns=columns)
In [13]: df
Out[13]:
B A
d c
z 0 2
y 1 3
在上一个版本中(future_stack=False),dropna=True 的默认值会删除无必要引入的 NA 值,但在此过程中仍会强制转换 dtype 为 float64。在新版本中,不会引入 NA,并且因此不会强制转换 dtype。
In [14]: df.stack([0, 1], future_stack=False, dropna=True)
Out[14]:
z A c 2.0
B d 0.0
y A c 3.0
B d 1.0
dtype: float64
In [15]: df.stack([0, 1], future_stack=True)
Out[15]:
z B d 0
A c 2
y B d 1
A c 3
dtype: int64
如果输入包含 NA 值,上一个版本将使用 dropna=True 删除这些值,或者使用 dropna=False 引入新的 NA 值。新版本将保留输入中的所有值。
In [16]: df = pd.DataFrame([[0, 2], [np.nan, np.nan]], columns=columns)
In [17]: df
Out[17]:
B A
d c
0 0.0 2.0
1 NaN NaN
In [18]: df.stack([0, 1], future_stack=False, dropna=True)
Out[18]:
0 A c 2.0
B d 0.0
dtype: float64
In [19]: df.stack([0, 1], future_stack=False, dropna=False)
Out[19]:
0 A d NaN
c 2.0
B d 0.0
c NaN
1 A d NaN
c NaN
B d NaN
c NaN
dtype: float64
In [20]: df.stack([0, 1], future_stack=True)
Out[20]:
0 B d 0.0
A c 2.0
1 B d NaN
A c NaN
dtype: float64
``` ### 其他增强
+ `Series.ffill()` 和 `Series.bfill()` 现在支持具有 `IntervalDtype` 的对象([GH 54247](https://github.com/pandas-dev/pandas/issues/54247))
+ 添加了 `filters` 参数到 `read_parquet()` 以过滤数据,兼容 `engines`([GH 53212](https://github.com/pandas-dev/pandas/issues/53212))
+ `Categorical.map()` 和 `CategoricalIndex.map()` 现在有一个 `na_action` 参数。`Categorical.map()` 隐式地对 `na_action` 有一个默认值 `"ignore"`。这已正式被弃用,并将在未来更改为 `None`。还要注意,`Series.map()` 的默认 `na_action=None`,并且对具有分类数据的系列的调用现在将使用 `na_action=None`,除非显式设置为其他值([GH 44279](https://github.com/pandas-dev/pandas/issues/44279))
+ `api.extensions.ExtensionArray` 现在有一个 `map()` 方法([GH 51809](https://github.com/pandas-dev/pandas/issues/51809))
+ `DataFrame.applymap()` 现在使用底层 `api.extensions.ExtensionArray` 实例的 `map()` 方法([GH 52219](https://github.com/pandas-dev/pandas/issues/52219))
+ `MultiIndex.sort_values()` 现在支持 `na_position`([GH 51612](https://github.com/pandas-dev/pandas/issues/51612))
+ `MultiIndex.sortlevel()`和`Index.sortlevel()`获得了一个新关键字`na_position`([GH 51612](https://github.com/pandas-dev/pandas/issues/51612))。
+ `arrays.DatetimeArray.map()`、`arrays.TimedeltaArray.map()`和`arrays.PeriodArray.map()`现在可以接受一个`na_action`参数([GH 51644](https://github.com/pandas-dev/pandas/issues/51644))。
+ `arrays.SparseArray.map()`现在支持`na_action`([GH 52096](https://github.com/pandas-dev/pandas/issues/52096))。
+ 当与 URL 一起使用时,`pandas.read_html()`现在支持`storage_options`关键字,允许用户向出站 HTTP 请求添加标头([GH 49944](https://github.com/pandas-dev/pandas/issues/49944))。
+ 添加`Index.diff()`和`Index.round()`([GH 19708](https://github.com/pandas-dev/pandas/issues/19708))。
+ 将`"latex-math"`添加为`Styler`的`escape`参数的选项,这样在格式化时不会转义`"\("`和`"\)"`之间的所有字符([GH 51903](https://github.com/pandas-dev/pandas/issues/51903))。
+ 在`CategoricalDtype`的`repr`信息中添加了类别的 dtype([GH 52179](https://github.com/pandas-dev/pandas/issues/52179))。
+ 在`read_excel()`中添加了`engine_kwargs`参数([GH 52214](https://github.com/pandas-dev/pandas/issues/52214))。
+ 在新的子模块`pandas.api.typing`中将对类型提示有用的类添加到公共 API 中([GH 48577](https://github.com/pandas-dev/pandas/issues/48577))。
+ 实现了`Series.dt.is_month_start`,`Series.dt.is_month_end`,`Series.dt.is_year_start`,`Series.dt.is_year_end`,`Series.dt.is_quarter_start`,`Series.dt.is_quarter_end`,`Series.dt.days_in_month`,`Series.dt.unit`,`Series.dt.normalize`,`Series.dt.day_name()`,`Series.dt.month_name()`,`Series.dt.tz_convert()` 用于 `pyarrow.timestamp` 的 `ArrowDtype` ([GH 52388](https://github.com/pandas-dev/pandas/issues/52388),[GH 51718](https://github.com/pandas-dev/pandas/issues/51718))
+ 当索引不是 `MultiIndex` 时,`DataFrameGroupBy.agg()` 和 `DataFrameGroupBy.transform()` 现在支持按多个键分组,用于 `engine="numba"` ([GH 53486](https://github.com/pandas-dev/pandas/issues/53486))
+ `SeriesGroupBy.agg()` 和 `DataFrameGroupBy.agg()` 现在支持将多个函数传递给 `engine="numba"` ([GH 53486](https://github.com/pandas-dev/pandas/issues/53486))
+ `SeriesGroupBy.transform()` 和 `DataFrameGroupBy.transform()` 现在支持将字符串作为 `engine="numba"` 的函数传递([GH 53579](https://github.com/pandas-dev/pandas/issues/53579))
+ `DataFrame.stack()` 添加了 `sort` 关键字,用于指定生成的 `MultiIndex` 是否排序([GH 15105](https://github.com/pandas-dev/pandas/issues/15105))
+ `DataFrame.unstack()` 添加了 `sort` 关键字,用于指定生成的 `MultiIndex` 是否排序([GH 15105](https://github.com/pandas-dev/pandas/issues/15105))
+ `Series.explode()` 现在支持 PyArrow 支持的列表类型([GH 53602](https://github.com/pandas-dev/pandas/issues/53602))
+ `Series.str.join()` 现在支持 `ArrowDtype(pa.string())` ([GH 53646](https://github.com/pandas-dev/pandas/issues/53646))
+ 给 `Categorical.from_codes()` 添加了 `validate` 参数([GH 50975](https://github.com/pandas-dev/pandas/issues/50975))
+ 添加了 `ExtensionArray.interpolate()`,被 `Series.interpolate()` 和 `DataFrame.interpolate()` 使用([GH 53659](https://github.com/pandas-dev/pandas/issues/53659))
+ 向 `DataFrame.to_excel()` 添加了 `engine_kwargs` 参数([GH 53220](https://github.com/pandas-dev/pandas/issues/53220))
+ 对 `DatetimeTZDtype` 实现了 `api.interchange.from_dataframe()`([GH 54239](https://github.com/pandas-dev/pandas/issues/54239))
+ 在 `DatetimeTZDtype` 上实现了 `__from_arrow__`([GH 52201](https://github.com/pandas-dev/pandas/issues/52201))
+ 实现了 `__pandas_priority__`,允许自定义类型优先于 `DataFrame`、`Series`、`Index` 或 `ExtensionArray` 进行算术运算,请参阅开发者指南([GH 48347](https://github.com/pandas-dev/pandas/issues/48347))
+ 改进了使用 `DataFrame.merge()` 时出现不兼容列时的错误消息([GH 51861](https://github.com/pandas-dev/pandas/issues/51861))
+ 在通过 `DataFrame.isetitem()` 设置具有错误列数的 `DataFrame` 时,改进了错误消息([GH 51701](https://github.com/pandas-dev/pandas/issues/51701))
+ 使用不兼容的 `index` 和 `orient` 参数时,改进了 `DataFrame.to_json()` 的错误处理([GH 52143](https://github.com/pandas-dev/pandas/issues/52143))
+ 在创建具有空数据(0 行)、没有索引和不正确列数的 DataFrame 时,改进了错误消息([GH 52084](https://github.com/pandas-dev/pandas/issues/52084))
+ 在为 `VariableOffsetWindowIndexer` 提供无效的 `index` 或 `offset` 参数时改进了错误消息([GH 54379](https://github.com/pandas-dev/pandas/issues/54379))
+ 让 `DataFrame.to_feather()` 接受一个非默认的 `Index` 和非字符串列名 ([GH 51787](https://github.com/pandas-dev/pandas/issues/51787))。
+ 向 `Series.apply()` 和 `DataFrame.apply()` 添加了一个新参数`by_row`。当设置为`False`时,提供的可调用函数将始终作用于整个 Series 或 DataFrame ([GH 53400](https://github.com/pandas-dev/pandas/issues/53400), [GH 53601](https://github.com/pandas-dev/pandas/issues/53601))。
+ `DataFrame.shift()` 和 `Series.shift()` 现在允许通过提供一个周期列表进行多周期移位 ([GH 44424](https://github.com/pandas-dev/pandas/issues/44424))。
+ 使用 `numba` 的 Groupby 聚合(例如 `DataFrameGroupBy.sum()`)现在可以保留输入的 dtype 而不是强制转换为 `float64` ([GH 44952](https://github.com/pandas-dev/pandas/issues/44952))。
+ 当 `DataFrameGroupBy.agg()` 失败时,改进了错误消息 ([GH 52930](https://github.com/pandas-dev/pandas/issues/52930))。
+ 许多读取/写入 _* 函数,例如 `DataFrame.to_pickle()` 和 `read_csv()`,支持将压缩参数转发给 `lzma.LZMAFile` ([GH 52979](https://github.com/pandas-dev/pandas/issues/52979))。
+ 对于对象 dtype,现在支持缩减`Series.argmax()`、`Series.argmin()`、`Series.idxmax()`、`Series.idxmin()`、`Index.argmax()`、`Index.argmin()`、`DataFrame.idxmax()`、`DataFrame.idxmin()`([GH 4279](https://github.com/pandas-dev/pandas/issues/4279)、[GH 18021](https://github.com/pandas-dev/pandas/issues/18021)、[GH 40685](https://github.com/pandas-dev/pandas/issues/40685)、[GH 43697](https://github.com/pandas-dev/pandas/issues/43697))
+ `DataFrame.to_parquet()`和`read_parquet()`现在分别写入和读取`attrs`([GH 54346](https://github.com/pandas-dev/pandas/issues/54346))
+ 与`Series.all()`和`Series.any()`的行为相匹配,浮点 dtype 和 timedelta64 dtype 的`Index.all()`和`Index.any()`不再引发`TypeError`([GH 54566](https://github.com/pandas-dev/pandas/issues/54566))
+ 对于 pyarrow 版本 13.0 及以上,现在支持`Series.cummax()`、`Series.cummin()`和`Series.cumprod()`的 pyarrow dtypes([GH 52085](https://github.com/pandas-dev/pandas/issues/52085))
+ 已添加对 DataFrame Consortium 标准的支持([GH 54383](https://github.com/pandas-dev/pandas/issues/54383))
+ 在 `DataFrameGroupBy.quantile()` 和 `SeriesGroupBy.quantile()` 中提升了性能 ([GH 51722](https://github.com/pandas-dev/pandas/issues/51722))
+ 基于 PyArrow 的整数数据类型现在支持位运算 ([GH 54495](https://github.com/pandas-dev/pandas/issues/54495)) ## 不兼容的 API 更改
### 增加了 Python 的最低版本要求
pandas 2.1.0 支持 Python 3.9 及更高版本。
### 增加了依赖项的最低版本要求
一些依赖项的最低支持版本已更新。如果已安装,我们现在要求:
| 包名 | 最低版本 | 必需 | 更改 |
| --- | --- | --- | --- |
| numpy | 1.22.4 | X | X |
| mypy (dev) | 1.4.1 | | X |
| beautifulsoup4 | 4.11.1 | | X |
| bottleneck | 1.3.4 | | X |
| dataframe-api-compat | 0.1.7 | | X |
| fastparquet | 0.8.1 | | X |
| fsspec | 2022.05.0 | | X |
| hypothesis | 6.46.1 | | X |
| gcsfs | 2022.05.0 | | X |
| jinja2 | 3.1.2 | | X |
| lxml | 4.8.0 | | X |
| numba | 0.55.2 | | X |
| numexpr | 2.8.0 | | X |
| openpyxl | 3.0.10 | | X |
| pandas-gbq | 0.17.5 | | X |
| psycopg2 | 2.9.3 | | X |
| pyreadstat | 1.1.5 | | X |
| pyqt5 | 5.15.6 | | X |
| pytables | 3.7.0 | | X |
| pytest | 7.3.2 | | X |
| python-snappy | 0.6.1 | | X |
| pyxlsb | 1.0.9 | | X |
| s3fs | 2022.05.0 | | X |
| scipy | 1.8.1 | | X |
| sqlalchemy | 1.4.36 | | X |
| tabulate | 0.8.10 | | X |
| xarray | 2022.03.0 | | X |
| xlsxwriter | 3.0.3 | | X |
| zstandard | 0.17.0 | | X |
对于[可选库](https://pandas.pydata.org/docs/getting_started/install.html),一般建议使用最新版本。
查看依赖项和可选依赖项以获取更多信息。
### 其他 API 更改
+ `arrays.PandasArray` 已重命名为 `NumpyExtensionArray`,附加的 dtype 名称从 `PandasDtype` 更改为 `NumpyEADtype`;导入 `PandasArray` 仍然有效,直到下一个主要版本 ([GH 53694](https://github.com/pandas-dev/pandas/issues/53694)) ## 弃用
### 弃用了类似于 setitem 的 Series 操作中的静默类型转换
PDEP-6: [`pandas.pydata.org/pdeps/0006-ban-upcasting.html`](https://pandas.pydata.org/pdeps/0006-ban-upcasting.html)
Series(或 DataFrame 列)上的类似 setitem 的操作,如果静默转换 dtype,则已弃用并显示警告。受影响操作的示例包括:
+ `ser.fillna('foo', inplace=True)`
+ `ser.where(ser.isna(), 'foo', inplace=True)`
+ `ser.iloc[indexer] = 'foo'`
+ `ser.loc[indexer] = 'foo'`
+ `df.iloc[indexer, 0] = 'foo'`
+ `df.loc[indexer, 'a'] = 'foo'`
+ `ser[indexer] = 'foo'`
其中 `ser` 是一个 `Series`,`df` 是一个 `DataFrame`,而 `indexer` 可以是切片、掩码、单个值、值列表或数组,或者其他任何允许的索引器。
在将来的版本中,这些将引发错误,您应首先转换为公共 dtype。
*先前行为*:
```py
In [1]: ser = pd.Series([1, 2, 3])
In [2]: ser
Out[2]:
0 1
1 2
2 3
dtype: int64
In [3]: ser[0] = 'not an int64'
In [4]: ser
Out[4]:
0 not an int64
1 2
2 3
dtype: object
新行为:
In [1]: ser = pd.Series([1, 2, 3])
In [2]: ser
Out[2]:
0 1
1 2
2 3
dtype: int64
In [3]: ser[0] = 'not an int64'
FutureWarning:
Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas.
Value 'not an int64' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.
In [4]: ser
Out[4]:
0 not an int64
1 2
2 3
dtype: object
为保留当前行为,在上述情况下,您可以首先将 ser 转换为 object dtype:
In [21]: ser = pd.Series([1, 2, 3])
In [22]: ser = ser.astype('object')
In [23]: ser[0] = 'not an int64'
In [24]: ser
Out[24]:
0 not an int64
1 2
2 3
dtype: object
根据使用情况,可能更适合转换为不同的 dtype。例如,在以下情况下,我们转换为 float64:
In [25]: ser = pd.Series([1, 2, 3])
In [26]: ser = ser.astype('float64')
In [27]: ser[0] = 1.1
In [28]: ser
Out[28]:
0 1.1
1 2.0
2 3.0
dtype: float64
欲了解更多,请参阅 pandas.pydata.org/pdeps/0006-ban-upcasting.html。
废弃解析具有混合时区的日期时间
废弃混合时区解析日期时间,并显示警告,除非用户将 utc=True 传递给 to_datetime()(GH 50887)
先前行为:
In [7]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"]
In [8]: pd.to_datetime(data, utc=False)
Out[8]:
Index([2020-01-01 00:00:00+06:00, 2020-01-01 00:00:00+01:00], dtype='object')
新行为:
In [9]: pd.to_datetime(data, utc=False)
FutureWarning:
In a future version of pandas, parsing datetimes with mixed time zones will raise
a warning unless `utc=True`. Please specify `utc=True` to opt in to the new behaviour
and silence this warning. To create a `Series` with mixed offsets and `object` dtype,
please use `apply` and `datetime.datetime.strptime`.
Index([2020-01-01 00:00:00+06:00, 2020-01-01 00:00:00+01:00], dtype='object')
为了消除此警告并避免 pandas 未来版本中的错误,请指定 utc=True:
In [29]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"]
In [30]: pd.to_datetime(data, utc=True)
Out[30]: DatetimeIndex(['2019-12-31 18:00:00+00:00', '2019-12-31 23:00:00+00:00'], dtype='datetime64[ns, UTC]', freq=None)
要创建具有混合偏移和 object dtype 的 Series,请使用 apply 和 datetime.datetime.strptime:
In [31]: import datetime as dt
In [32]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"]
In [33]: pd.Series(data).apply(lambda x: dt.datetime.strptime(x, '%Y-%m-%d %H:%M:%S%z'))
Out[33]:
0 2020-01-01 00:00:00+06:00
1 2020-01-01 00:00:00+01:00
dtype: object
其他废弃内容
-
废弃
DataFrameGroupBy.dtypes,请检查底层对象的dtypes代替(GH 51045) -
废弃
DataFrame._data和Series._data,请使用公共 API 代替(GH 33333) -
废弃
concat()的行为,当被连接的任何对象的长度为 0 时;过去,在确定结果 dtype 时会忽略空对象的 dtypes,在将来的版本中将不再忽略。 -
废弃
Categorical.to_list(),请使用obj.tolist()替代(GH 51254) -
在具有 datetime64 或
PeriodDtype值的情况下,已弃用DataFrameGroupBy.all()和DataFrameGroupBy.any(),与Series和DataFrame弃用相匹配(GH 34479) -
在
DataFrame.ewm()、DataFrame.rolling()、DataFrame.expanding()中已弃用axis=1,在调用方法前请进行转置(GH 51778) -
在
DataFrame.groupby()和Grouper构造函数中已弃用axis=1,请使用frame.T.groupby(...)代替(GH 51203) -
在
Series.align()和DataFrame.align()中已弃用broadcast_axis关键字,在调用align前将其转换为left = DataFrame({col: left for col in right.columns}, index=right.index)(GH 51856) -
在
Index.fillna()中已弃用downcast关键字(GH 53956) -
在
DataFrame.pct_change()、Series.pct_change()、DataFrameGroupBy.pct_change()和SeriesGroupBy.pct_change()中,已弃用fill_method和limit关键词,调用例如DataFrame.ffill()或DataFrame.bfill()以在调用pct_change之前明确填充数据。(GH 53491) -
在
DataFrame.align()和Series.align()中,已弃用method、limit和fill_axis关键词,需明确在对齐结果上调用DataFrame.fillna()或Series.fillna()代替。(GH 51856) -
在
Rolling.quantile()和Expanding.quantile()中,已弃用quantile关键词,改为使用q代替。(GH 52550) -
在
DataFrame.take()中,不再接受切片,需调用obj[slicer]或传递整数序列代替。(GH 51539) -
已弃用
DataFrame.idxmax()、DataFrame.idxmin()、Series.idxmax()、Series.idxmin()在所有 NA 条目或任何 NA 和skipna=False时的行为;在将来的版本中,这些将引发ValueError(GH 51276) -
已弃用显式支持子类化
Index(GH 45289) -
将给定给
Series.agg()的已弃用的制作函数尝试对Series中的每个元素进行操作,仅在元素级操作失败时才对整个Series进行操作。将来,给定给Series.agg()的函数将始终仅对整个Series进行操作。要保持当前行为,请改用Series.transform()代替(GH 53325) -
已弃用使给定给
DataFrame.agg()的函数列表中的函数尝试对DataFrame中的每个元素进行操作,并仅在元素级操作失败时才对DataFrame的列进行操作。要保持当前行为,请改用DataFrame.transform()代替(GH 53325) -
已弃用将
DataFrame传递给DataFrame.from_records(),请改用DataFrame.set_index()或DataFrame.drop()代替(GH 51353) -
在将字符串解析为日期时间时,弃用了默默丢弃未识别时区的行为(GH 18702)
-
在
DataFrame.ewm(),Series.ewm(),DataFrame.rolling(),Series.rolling(),DataFrame.expanding(),Series.expanding()函数中弃用了axis关键字(GH 51778) -
在
DataFrame.resample(),Series.resample()函数中弃用了axis关键字(GH 51778) -
在
Series.interpolate(),DataFrame.interpolate(),Series.fillna(),DataFrame.fillna(),Series.ffill(),DataFrame.ffill(),Series.bfill(),DataFrame.bfill()函数中弃用了downcast关键字(GH 40988) -
在
concat()函数中弃用了当len(keys) != len(objs)时的行为,在将来的版本中将会引发异常,而不是截断到两个序列中较短的一个(GH 43485) -
在存在 NA 值时,弃用了
Series.argsort()函数的行为;在将来的版本中,这些值将被放在末尾,而不是给出 -1(GH 54219) -
在
DataFrame.groupby()和Series.groupby()中弃用了observed=False的默认设置;在将来的版本中,这将默认为True(GH 43999) -
在
SeriesGroupBy.aggregate()聚合中取消了将group.name固定到每个组的操作;如果您的操作需要使用 groupby 键,请遍历 groupby 对象而不是固定 group.name(GH 41090) -
在
DataFrameGroupBy.idxmax(),DataFrameGroupBy.idxmin(),DataFrameGroupBy.fillna(),DataFrameGroupBy.take(),DataFrameGroupBy.skew(),DataFrameGroupBy.rank(),DataFrameGroupBy.cumprod(),DataFrameGroupBy.cumsum(),DataFrameGroupBy.cummax(),DataFrameGroupBy.cummin(),DataFrameGroupBy.pct_change(),DataFrameGroupBy.diff(),DataFrameGroupBy.shift(), 和DataFrameGroupBy.corrwith()中弃用了axis关键字;对于axis=1则在底层的DataFrame上进行操作 (GH 50405, GH 51046) -
在
DataFrameGroupBy中,使用as_index=False时废弃了不包含 DataFrame 中未列为列的分组的结果 (GH 49519) -
废弃了
is_categorical_dtype(),改用isinstance(obj.dtype, pd.CategoricalDtype)代替 (GH 52527) -
废弃了
is_datetime64tz_dtype(),改用isinstance(dtype, pd.DatetimeTZDtype)进行检查 (GH 52607) -
废弃了
is_int64_dtype(),改用dtype == np.dtype(np.int64)进行检查 (GH 52564) -
废弃了
is_interval_dtype(),改用isinstance(dtype, pd.IntervalDtype)进行检查 (GH 52607) -
废弃了
is_period_dtype(),改用isinstance(dtype, pd.PeriodDtype)进行检查 (GH 52642) -
废弃了
is_sparse(),改用isinstance(dtype, pd.SparseDtype)进行检查 (GH 52642) -
废弃了
Styler.applymap_index()。请使用新的Styler.map_index()方法代替 (GH 52708) -
废弃了
Styler.applymap()。请使用新的Styler.map()方法代替 (GH 52708) -
废弃了
DataFrame.applymap()。请使用新的DataFrame.map()方法代替 (GH 52353) -
废弃了
DataFrame.swapaxes()和Series.swapaxes(),改用DataFrame.transpose()或Series.transpose()代替 (GH 51946) -
在
PeriodArray构造函数中废弃了freq参数,请传递dtype代替 (GH 52462) -
在
take()中弃用非标准输入的允许,传递一个numpy.ndarray、ExtensionArray、Index或Series中的一种 (GH 52981) -
在
isin()、value_counts()、unique()、factorize()中弃用非标准序列的允许,调用之前将序列转换为numpy.ndarray、Index、ExtensionArray或Series中的一种 (GH 52986) -
当
DataFrame进行sum、prod、std、var、sem的弃用行为,且axis=None时,在将来的版本中,这将同时作用于两个轴,返回标量而不是像axis=0一样的行为;注意这也会影响 numpy 函数,例如np.sum(df)(GH 21597) -
当
DataFrame的列全部为 NA 时,concat()的弃用行为,在将来的版本中,这些列将不会在确定结果 dtype 时被丢弃(GH 40893) -
Series.dt.to_pydatetime()的弃用行为,在将来的版本中,这将返回一个包含 pythondatetime对象而不是 datetimes 的ndarray的Series;这与其他Series.dt属性的行为一致(GH 20306) -
在 pandas 对象和无 dtype 序列(例如
list、tuple)之间的弃用逻辑操作(|,&,^),在操作之前将序列包装在一个Series或 NumPy 数组中 (GH 51521) -
在
Series.apply()中弃用了参数convert_type(GH 52140) -
弃用了将字典传递给
SeriesGroupBy.agg()的方式,请传递聚合列表代替(GH 50684) -
在
Categorical构造函数中弃用了fastpath关键字,请使用Categorical.from_codes()代替(GH 20110) -
弃用了
is_bool_dtype()方法对布尔对象的 object-dtypeIndex返回True的行为(GH 52680) -
弃用了方法
Series.bool()和DataFrame.bool()(GH 51749) -
在
DatetimeIndex构造函数中弃用了未使用的closed和normalize关键字(GH 52628) -
在
TimedeltaIndex构造函数中弃用了未使用的closed关键字(GH 52628) -
弃用了两个不同索引的非布尔
Series之间的逻辑操作,始终强制将结果转换为布尔类型。在将来的版本中,这将保持输入的返回类型(GH 52500,GH 52538) -
弃用了带有
BDay频率的Period和PeriodDtype,请使用带有BDay频率的DatetimeIndex代替(GH 53446) -
弃用了
value_counts(),请使用pd.Series(obj).value_counts()代替(GH 47862) -
弃用了
Series.first()和DataFrame.first();请使用.loc创建掩码并进行过滤(见 GH 45908) -
弃用了对象类型的
Series.interpolate()和DataFrame.interpolate()(见 GH 53631) -
弃用了
Series.last()和DataFrame.last();请使用.loc创建掩码并进行过滤(见 GH 53692) -
弃用了在
SparseDtype中允许任意fill_value的行为,在未来版本中,fill_value将需要与dtype.subtype兼容,即可以由该 subtype 所持有的标量或用于整数或布尔子类型的NaN(见 GH 23124) -
弃用了在
DataFrameGroupBy.quantile()和SeriesGroupBy.quantile()中允许 bool 类型的行为,与Series.quantile()和DataFrame.quantile()的行为一致(见 GH 51424) -
弃用了在
testing.assert_series_equal()和testing.assert_frame_equal()中考虑 NA 值(例如NaN与None视为等价)的行为(见 GH 52081) -
弃用了将字节输入到
read_excel()中的行为。要读取文件路径,请使用字符串或类似路径的对象(见 GH 53767) -
废弃了从标量数据构造
SparseArray,改为传递一个序列 (GH 53039) -
当
to_replace不像字典一样时,废弃了在DataFrame.replace()和Series.replace()中当value未指定时的填充回退 (GH 33302) -
废弃了
read_json()的字面 json 输入。改为在io.StringIO中包装字面 json 字符串输入 (GH 53409) -
废弃了字面字符串输入到
read_xml()。改为在io.StringIO/io.BytesIO中包装字面字符串/字节输入 (GH 53767) -
废弃了
read_html()的字面字符串/字节输入。改为在io.StringIO/io.BytesIO中包装字面字符串/字节输入 (GH 53767) -
废弃了选项
mode.use_inf_as_na,在之前将 inf 条目转换为NaN(GH 51684) -
废弃了
DataFrameGroupBy.get_group()中的参数obj(GH 53545) -
废弃了使用
Series.__getitem__()和Series.__setitem__()在Series上的位置索引,在将来版本中,ser[item]将始终解释item为标签,而不是位置 (GH 50617) -
废弃了在
.agg、.apply和.transform中替换内置和 NumPy 函数的方法;使用相应的字符串别名(例如"sum"代替sum或np.sum)替代 (GH 53425) -
废弃了字符串
T、t、L和l在to_timedelta()中表示单位 (GH 52536) -
废弃了在
.ExtensionArray.fillna中的“method”和“limit”关键字,改为实现_pad_or_backfill(GH 53621) -
弃用了
DataFrame.replace()和Series.replace()方法中的method和limit关键字(GH 33302) -
弃用了
Series.fillna()、DataFrame.fillna()、SeriesGroupBy.fillna()、DataFrameGroupBy.fillna()和Resampler.fillna()方法中的method和limit关键字,请改用obj.bfill()或obj.ffill()代替(GH 53394) -
弃用了对具有浮点型索引的对象上的
Series.__getitem__()、Series.__setitem__()、DataFrame.__getitem__()和DataFrame.__setitem__()方法使用整数切片的行为,在未来版本中,这将被视为位置索引(GH 49612) -
弃用了在
pandas.array()方法中使用不支持的 datetime64 和 timedelta64 分辨率。支持的分辨率有:"s"、"ms"、"us"、"ns"(GH 53058) -
弃用了
Series.interpolate()和DataFrame.interpolate()方法中的值"pad"、"ffill"、"bfill"、"backfill",请改用obj.ffill()或obj.bfill()代替(GH 53581) -
已弃用
Index.argmax()、Index.argmin()、Series.argmax()、Series.argmin()方法在所有-NAs 且skipna=True或任何-NAs 且skipna=False时返回-1 的行为;在将来的版本中,这将引发ValueError(GH 33941, GH 33942) -
已弃用在
DataFrame.to_sql()中允许非关键字参数,除了name和con之外的参数 (GH 54229) -
在将
freq和fill_value同时传递给DataFrame.shift()、Series.shift()和DataFrameGroupBy.shift()时,已弃用对fill_value的静默忽略;在将来的版本中,这将引发ValueError(GH 53832) ## 性能改进 -
在具有同类的
np.float64或np.float32数据类型的concat()中的性能改进 (GH 52685) -
对不包含字符串的对象列进行
factorize()的性能改进 (GH 51921) -
在读取远程 URI 文件路径时,
read_orc()的性能改进 (GH 51609) -
在使用
engine="pyarrow"读取远程文件时,read_parquet()和DataFrame.to_parquet()的性能改进 (GH 51609) -
在使用
use_nullable_dtypes=True时,read_parquet()中字符串列的性能改进 (GH 47345) -
在
DataFrame.clip()和Series.clip()中的性能改进(GH 51472) -
当给定
items时,在DataFrame.filter()中的性能改进(GH 52941) -
在扩展数组数据类型的
DataFrame.first_valid_index()和DataFrame.last_valid_index()中的性能改进(GH 51549) -
当
cond由扩展数据类型支持时,在DataFrame.where()中的性能改进(GH 51574) -
当
verify_integrity=True时,MultiIndex.set_levels()和MultiIndex.set_codes()中的性能改进(GH 51873) -
当
ascending是列表时,MultiIndex.sortlevel()中的性能改进(GH 51612) -
在
Series.combine_first()中的性能改进(GH 51777) -
当数组不包含空值时,在
fillna()中的性能改进(GH 51635) -
当数组没有空值或全部为空值时,在
isna()中的性能改进(GH 51630) -
当将字符串解析为
boolean[pyarrow]数据类型时的性能改进(GH 51730) -
Index从其他索引切片时的性能改进(GH 51738) -
Period的默认格式化器(period_format)现在显著(~两倍)更快。这提升了str(Period)、repr(Period)和Period.strftime(fmt=None)的性能,以及.PeriodArray.strftime(fmt=None)、.PeriodIndex.strftime(fmt=None)和.PeriodIndex.format(fmt=None)。涉及默认date_format的PeriodArray或PeriodIndex的to_csv操作也显著加快了(GH 51459) -
访问
arrays.IntegerArrays.dtype和arrays.FloatingArray.dtype的性能提升(GH 52998) -
DataFrameGroupBy/SeriesGroupBy聚合操作(例如DataFrameGroupBy.sum())在使用engine="numba"时的性能提升(GH 53731) -
在带有
axis=1和扩展数据类型的DataFrame缩减中的性能提升(GH 54341) -
带有
axis=None和扩展数据类型的DataFrame缩减中的性能提升(GH 54308) -
在索引/列值已经排序时的
MultiIndex和多列操作中的性能提升(例如DataFrame.sort_values()、DataFrame.groupby()、Series.unstack())(GH 53806) -
在
Series缩减操作中的性能提升(GH 52341) -
在
concat()中当axis=1且对象具有不同索引时的性能提升(GH 52541) -
当连接轴是
MultiIndex时,concat()的性能改进(GH 53574) -
PyArrow 支持的字符串在
merge()中的性能改进(GH 54443) -
使用
engine="c"时,read_csv()的性能改进(GH 52632) -
ArrowExtensionArray.to_numpy()的性能改进(GH 52525) -
DataFrameGroupBy.groups()的性能改进(GH 53088) -
当
dtype是扩展数据类型时,DataFrame.astype()的性能改进(GH 54299) -
当输入为单个整数且数据框由扩展数据类型支持时,
DataFrame.iloc()的性能改进(GH 54508) -
对扩展数据类型的
DataFrame.isin()的性能改进(GH 53514) -
在选择行和列时,
DataFrame.loc()的性能改进(GH 53014) -
在转置具有单个 PyArrow 数据类型的数据框时,
DataFrame.transpose()的性能改进(GH 54224) -
在转置具有单个掩码数据类型(例如
Int64)的数据框时,DataFrame.transpose()的性能改进(GH 52836) -
对 PyArrow 字符串和二进制数据类型的
Series.add()的性能改进(GH 53150) -
改进了在扩展数据类型上的
Series.corr()和Series.cov()方法的性能(GH 52502)。 -
改进了在
ArrowDtype上的Series.drop_duplicates()方法的性能(GH 54667)。 -
在 PyArrow 数据类型上使用
Series.ffill()、Series.bfill()、DataFrame.ffill()和DataFrame.bfill()方法时,性能有所提升(GH 53950)。 -
在 PyArrow 支持的字符串上使用
Series.str.get_dummies()方法时,性能得到改进(GH 53655)。 -
改进了在 PyArrow 支持的字符串上的
Series.str.get()方法的性能(GH 53152)。 -
改进了
Series.str.split()使用expand=True参数在 PyArrow 支持的字符串上的性能(GH 53585)。 -
当数据类型为 NumPy 浮点数据类型且
na_value为np.nan时,Series.to_numpy()的性能有所提升(GH 52430)。 -
在从 PyArrow 时间戳或持续时间数据类型转换为 NumPy 时,改进了
astype()的性能(GH 53326)。 -
在各种
MultiIndex设置和索引操作中,性能得到提升(GH 53955)。 -
在对
arrays.IntegerArray和arrays.FloatingArray进行各种重塑操作时,通过避免进行不必要的验证,性能有所改善(GH 53013)。 -
使用 PyArrow 时间戳和持续时间 dtypes 进行索引时的性能提升(GH 53368)。
-
当将数组传递给
RangeIndex.take()、DataFrame.loc()或DataFrame.iloc(),并且 DataFrame 使用 RangeIndex 时,对性能进行了改进(GH 53387)。
Categorical
-
在
CategoricalIndex.remove_categories()中存在一个错误,其中有序类别将不会被维护(GH 53935)。 -
在
dtype="category"的情况下,使用Series.astype()时出现错误,对于具有只读空值掩码的可空数组(GH 53658)。 -
在
Series.map()中存在一个错误,如果系列持有一个Categorical,则na_action参数的值将不会被使用(GH 22527)。
Datetimelike
-
DatetimeIndex.map()与na_action="ignore"现在按预期工作(GH 51644)。 -
DatetimeIndex.slice_indexer()现在对非单调索引引发KeyError,如果切片边界之一不在索引中;此行为先前已被弃用,但处理不一致(GH 53983)。 -
在乘以常数时,
DateOffset的行为不一致(GH 47953)。 -
当
freq是带有nanoseconds的DateOffset时,在date_range()中存在一个错误(GH 46877)。 -
在
to_datetime()转换包含 PyArrow 时间戳的Series或DataFrame到 numpy datetimes 时出现错误,这些时间戳是arrays.ArrowExtensionArray(GH 52545)。 -
在
DatetimeArray.map()和DatetimeIndex.map()中的错误,其中提供的可调用对象是数组级别的操作而不是元素级别的操作(GH 51977) -
在使用 PyArrow 支持的日期类型时,
DataFrame.to_sql()引发ValueError的错误(GH 53854) -
Timestamp.date()、Timestamp.isocalendar()、Timestamp.timetuple()和Timestamp.toordinal()中的错误,对于超出 Python 标准库的 datetime 模块支持范围的输入,返回的结果不正确(GH 53668) -
Timestamp.round()中的错误,在接近实现边界的值返回不正确的结果,而不是引发OutOfBoundsDatetime(GH 51494) -
从日期时间或时间差标量构造
Series或DataFrame的错误,总是推断出纳秒分辨率而不是根据输入推断(GH 52212) -
从表示时间而不带日期的字符串构造
Timestamp的错误,推断出不正确的单位(GH 54097) -
使用
ts_input=pd.NA构造Timestamp引发TypeError的错误(GH 45481) -
解析带有工作日但没有日期的日期时间字符串的错误,例如“2023 年 9 月星期四”,错误地引发
AttributeError而不是ValueError(GH 52659) -
当 dtype 是带有非纳秒分辨率的时区感知日期时间时,
Series的 repr 中存在错误,引发OutOfBoundsDatetime(GH 54623)
时间差
-
TimedeltaIndex的除法或乘法导致.freq为“0 天”而不是None的问题(GH 51575) -
Bug in
Timedelta中 NumPytimedelta64对象未能正确引发ValueError的问题(GH 52806) -
Bug in
to_timedelta()将包含pyarrow.duration的Series或DataFrame转换为 NumPytimedelta64时出现问题(GH 54298) -
Timedelta.__hash__()中的问题,在某些大秒分辨率值上引发OutOfBoundsTimedelta(GH 54037) -
Bug in
Timedelta.round()对接近实现边界的值返回不正确结果而不是引发OutOfBoundsTimedelta的问题(GH 51494) -
TimedeltaIndex.map()中带有na_action="ignore"的问题(GH 51644) -
arrays.TimedeltaArray.map()和TimedeltaIndex.map()中的问题,提供的可调用函数是数组级别操作而不是元素级别操作(GH 51977)
时区
-
Bug in
infer_freq()对带有时区信息的时间戳Series引发TypeError的问题(GH 52456) -
DatetimeTZDtype.base()总是返回具有纳秒分辨率的 NumPy 数据类型的问题(GH 52705)
数值
-
Bug in
RangeIndex在被减数为数值时,设置step不正确的问题(GH 53255) -
Bug in
Series.corr()和Series.cov()对带有掩码数据类型的对象引发AttributeError的问题(GH 51422) -
在调用全零 NumPy 数据的
Series.kurt()和Series.skew()时返回 Python 类型而不是 NumPy 类型的 Bug (GH 53482) -
在包含可以转换为数字的字符串(例如“2”)的 object-dtype 值的
Series.mean()、DataFrame.mean()存在的 Bug 导致返回不正确的数值结果;现在这些会引发TypeError(GH 36703, GH 44008) -
在 PyArrow-backed dtypes 上调用
DataFrame.corrwith()时出现NotImplementedError的 Bug (GH 52314) -
在调用
DataFrame.size()和Series.size()时,返回 64 位整数而不是 Python int 的 Bug (GH 52897) -
DateFrame.dot()中存在的 Bug 导致对ArrowDtype数据返回object数据类型(GH 53979) -
在
Series.any()、Series.all()、DataFrame.any()和DataFrame.all()中,默认值bool_only设置为None而不是False的 Bug;这个改变对用户没有影响 (GH 53258) -
在调用
Series.corr()和Series.cov()时,对于 masked dtypes 抛出AttributeError的 Bug (GH 51422) -
Series.median()和DataFrame.median()中的错误,包含可转换为数字的字符串的 object-dtype 值(例如“2”)返回不正确的数值结果;现在会引发TypeError(GH 34671) -
Series.sum()中的错误,将uint64转换为int64类型(GH 53401)
转换
-
如果 DataFrame 包含比浮点双精度浮点数能表示的更多位数的整数,则
DataFrame.style.to_latex()和DataFrame.style.to_html()中的错误(GH 52272) -
在给定单位为“s”、“us”或“ms”的
datetime64或timedelta64类型时,array()中的错误返回NumpyExtensionArray而不是DatetimeArray或TimedeltaArray(GH 52859) -
在给定空列表且没有 dtype 的情况下,
array()中的错误返回NumpyExtensionArray而不是FloatingArray(GH 54371) -
ArrowDtype.numpy_dtype()中的错误,对于非纳秒pyarrow.timestamp和pyarrow.duration类型返回纳秒单位(GH 51800) -
DataFrame.__repr__()中的错误,当列的 dtype 为np.record时错误地引发TypeError(GH 48526) -
DataFrame.info()中的错误,在设置use_numba时引发ValueError(GH 51922) -
DataFrame.insert()中的错误,如果loc是np.int64则引发TypeError([GH 53193](https://github.com/pandas-dev/pandas/issues/53193) -
HDFStore.select()中的错误,在存储和检索时,会丢失大整数的精度(GH 54186) -
Series.astype()中的错误,不支持object_类型(GH 54251)
字符串
区间
-
当
target是只读数组时,IntervalIndex.get_indexer()和IntervalIndex.get_indexer_nonunique()会引发错误(GH 53703) -
IntervalDtype中的错误,在删除时对象可能会被保留(GH 54184) -
interval_range()中的错误,当浮点数step产生浮点数的副作用时,会产生不正确的间隔(GH 54477)
索引
-
当将一个
DataFrame设置到重复列时,DataFrame.__setitem__()丢失 dtype 中的错误(GH 53143) -
在使用布尔掩码时,
DataFrame.__setitem__()和DataFrame.putmask()对于混合非数值类型和除NaN之外的值会错误地引发TypeError(GH 53291) -
在使用
nan作为唯一元素时,DataFrame.iloc()中的错误(GH 52234) -
Series.loc()中的错误,在将预定义索引的object类型的Series分配给Series时将Series强制转换为np.dnarray(GH 48933)
缺失
-
在
method为"pad"、"ffill"、"bfill"或"backfill"时,DataFrame.interpolate()未能填充数据(GH 53898) -
当
DataFrame为空时,DataFrame.interpolate()忽略了inplace(GH 53199) -
Series.idxmin()、Series.idxmax()、DataFrame.idxmin()、DataFrame.idxmax()在包含NaT的DatetimeIndex索引中的错误,将错误地返回NaN而不是NaT(GH 43587) -
在无效的
downcast关键字上,Series.interpolate()和DataFrame.interpolate()未能引发错误,此关键字只能为None或"infer"(GH 53103) -
具有复杂数据类型的
Series.interpolate()和DataFrame.interpolate()错误地未能填充NaN条目(GH 53635)
MultiIndex
I/O
-
DataFrame.to_orc()函数现在在给定非默认Index时引发ValueError(GH 51828) -
DataFrame.to_sql()函数在使用 SQLAlchemy 连接时未提供name参数时会引发ValueError(GH 52675) -
json_normalize()函数无法解析元数据字段列表类型 (GH 37782) -
read_csv()函数在将parse_dates设置为列表或字典且使用engine="pyarrow"时会出错 (GH 47961) -
read_csv()函数在使用engine="pyarrow"并指定index_col时引发错误 (GH 53229) -
read_hdf()函数在引发IndexError后未正确关闭存储 (GH 52781) -
read_html()函数错误地将样式元素读取为 DataFrame (GH 52197) -
read_html()函数在与包含display:none样式的元素一起删除尾部文本时发生错误 (GH 51629) -
read_sql_table()函数在读取视图时引发异常 (GH 52969) -
read_sql()函数在读取具有相同列名的多个时区感知列时出错 (GH 44421) -
read_xml()函数会剥离字符串数据中的空格 (GH 53811) -
DataFrame.to_html()函数在多级索引列情况下错误地应用了colspace(GH 53885) -
DataFrame.to_html()中的错误,当空的DataFrame具有复杂 dtype 时引发ValueError(GH 54167) -
DataFrame.to_json()中的错误,DateTimeArray/DateTimeIndex��有非纳秒精度时无法正确序列化(GH 53686) -
写入和读取空的 Stata dta 文件时丢失 dtype 信息的错误(GH 46240)
-
将
bz2视为硬性要求的错误(GH 53857)
期间
-
PeriodDtype构造函数在不传递参数或传递None时未能引发TypeError的错误(GH 27388) -
PeriodDtype构造函数在不同的DateOffsetfreq输入下错误地返回相同的normalize(GH 24121) -
PeriodDtype构造函数在传递无效类型时引发ValueError而不是TypeError的错误(GH 51790) -
PeriodDtype中的错误,当删除时对象可能仍保持活动状态(GH 54184) -
read_csv()中的错误,不将空字符串处理为 null 值,使用engine="pyarrow"时(GH 52087) -
read_csv()中的错误,使用engine="pyarrow"时,将所有空列返回为objectdtype 列而不是float64dtype 列,对于所有使用engine="pyarrow"的空列(GH 52087) -
Period.now()中的错误,不接受freq参数作为关键字参数(GH 53369) -
PeriodIndex.map()中的错误,使用na_action="ignore"时(GH 51644) -
arrays.PeriodArray.map()和PeriodIndex.map()中的错误,提供的可调用函数是数组级别操作而不是元素级别操作(GH 51977) -
在错误地允许使用
CustomBusinessDay频率构造Period或PeriodDtype时存在的错误;请改用BusinessDay(GH 52534)
绘图
-
当以
color=None调用时,在Series.plot()中存在的错误 (GH 51953) -
在以
c="b"调用时,修复了DataFrame.plot.scatter()中的 UserWarning (GH 53908)
Groupby/resample/rolling
-
当在空 DataFrameGroupBy 或 SeriesGroupBy 上使用时,
DataFrameGroupBy.idxmin()、SeriesGroupBy.idxmin()、DataFrameGroupBy.idxmax()、SeriesGroupBy.idxmax()返回错误的数据类型 (GH 51423) -
在传递
na_option="bottom"或na_option="top"时,可空数据类型上存在的DataFrame.groupby.rank()中的错误 (GH 54206) -
在在
TimedeltaIndex上重新采样时,错误地允许非固定freq的DataFrame.resample()和Series.resample()中的错误 (GH 51896) -
在重新采样空数据时,
DataFrame.resample()和Series.resample()中丢失时区的错误 (GH 53664) -
在
DataFrame.resample()和Series.resample()中存在的 bug,当值在轴外时,origin在重新采样时没有效果(GH 53662) -
在指定
min_periods=0时,加权滚动聚合中存在的 bug(GH 51449) -
在
DataFrame.groupby()和Series.groupby()中存在的 bug,当分组的Series或DataFrame的索引是DatetimeIndex、TimedeltaIndex或PeriodIndex时,且groupby方法的第一个参数是函数时,该函数会作用于整个索引而不是索引的每个元素(GH 51979) -
在
DataFrameGroupBy.agg()中存在的 bug,列表��遵守as_index=False(GH 52849) -
在
DataFrameGroupBy.apply()中存在的 bug,当输入的DataFrame在 groupby 后被子集化为DataFrame([['a']]而不是['a']),并且给定的可调用函数返回的Series不是全部具有相同索引时,会引发错误(GH 52444) -
在
DataFrameGroupBy.apply()中存在的 bug,当选择多列并提供返回np.ndarray结果的函数时,会引发TypeError错误(GH 18930) -
DataFrameGroupBy.groups()和SeriesGroupBy.groups()中的 Bug,在与另一个键一起使用日期时间键时,会产生不正确的分组键数量(GH 51158) -
DataFrameGroupBy.quantile()和SeriesGroupBy.quantile()中的 Bug 可能会在sort=False的情况下隐式对结果索引进行排序(GH 53009) -
SeriesGroupBy.size()中的 Bug,对于具有ArrowDtype或掩码数据类型(例如Int64)的数据,dtype 将为np.int64(GH 53831) -
DataFrame.groupby()中的 Bug,在结果 groupby 对象上进行列选择时,当通过由单个元素组成的列表进行分组时,不返回元组名称(GH 53500) -
DataFrameGroupBy.var()和SeriesGroupBy.var()中的 Bug,在使用 datetime64、timedelta64 或PeriodDtype值时未能引发TypeError(GH 52128,GH 53045) -
DataFrameGroupBy.resample()中的 Bug,在kind="period"时引发AttributeError(GH 24103) -
Resampler.ohlc()中存在错误,当返回空对象时返回Series而不是空的DataFrame(GH 42902) -
在具有
ArrowDtype或掩码数据类型(例如Int64)的数据中,SeriesGroupBy.count()和DataFrameGroupBy.count()的 dtype 将为np.int64(GH 53831) -
在使用
dropna="any"或dropna="all"进行列选择后,SeriesGroupBy.nth()和DataFrameGroupBy.nth()存在错误,不会对列进行子集划分 (GH 53518) -
在使用
dropna="any"或dropna="all"进行列选择后,SeriesGroupBy.nth()和DataFrameGroupBy.nth()存在错误,导致行被删除 (GH 53518) -
SeriesGroupBy.sum()和DataFrameGroupBy.sum()存在错误,将np.inf + np.inf和(-np.inf) + (-np.inf)合计为np.nan而不是分别为np.inf和-np.inf(GH 53606) -
Series.groupby()中的错误,当分组的Series具有DatetimeIndex索引和名称为月份的Series被给定到by参数时会引发错误(GH 48509)
重塑
-
concat()中的错误,当一列具有pa.null()数据类型时,会强制转换为object数据类型(GH 53702) -
crosstab()中的错误,当dropna=False时不会在结果中保留np.nan(GH 10772) -
melt()中的错误,variable列会丢失扩展数据类型(GH 54297) -
merge_asof()中的错误,当扩展的数据类型引发KeyError时会抛出异常(GH 52904) -
merge_asof()中的错误,当数据由只读的 ndarrays 支持时会引发ValueError(GH 53513) -
merge_asof()中的错误,在某些情况下,当left_index=True或right_index=True且索引类型不匹配时,会返回不正确的结果而不是引发MergeError(GH 53870) -
merge()中的错误,当在整数ExtensionDtype和浮点数 NumPy 数据类型上合并时会引发TypeError(GH 46178) -
DataFrame.agg()和Series.agg()中的错误,当非唯一列传递 dist-like 参数时,返回的类型不正确(GH 51099) -
DataFrame.combine_first()中的错误,如果other是空的,则会忽略其他列(GH 53792) -
在
DataFrame.idxmin()和DataFrame.idxmax()中存在错误,当帧为空时,轴的 dtype 会丢失(GH 53265) -
在
DataFrame.merge()中存在错误,当具有单级MultiIndex时无法正确合并(GH 52331) -
在
DataFrame.stack()中存在错误,当列是MultiIndex且帧包含混合 dtype 时,会丢失扩展 dtype(GH 45740) -
在
DataFrame.stack()中存在错误,对列进行字典排序(GH 53786) -
在
DataFrame.transpose()中存在错误,为对象列推断 dtype 时出现错误(GH 51546) -
在
Series.combine_first()中存在错误,将int64dtype 转换为float64并丢失非常大整数的精度(GH 51764) -
在连接空
DataFrame对象时存在错误,连接的索引将是RangeIndex而不是连接的索引类型(GH 52777)
稀疏
-
在
SparseDtype构造函数中存在错误,当给定不兼容的dtype作为其子类型时,未能引发TypeError,其子类型必须是 NumPy 的 dtype(GH 53160) -
在
arrays.SparseArray.map()中存在错误,允许填充值包含在稀疏值中(GH 52095)
扩展数组
-
在
ArrowStringArray构造函数中存在错误,当使用字符串字典类型时引发ValueError(GH 54074) -
在给定字典时,
DataFrame构造函数不会复制具有扩展 dtype 的Series的错误(GH 53744) -
将 pandas 非纳秒时间对象从非零值转换为零值的
ArrowExtensionArray中存在错误(GH 53171) -
在 PyArrow 时间类型中引发
ArrowInvalid的Series.quantile()中存在错误(GH 52678) -
对于具有
Float64dtype 的小值,Series.rank()返回错误的顺序的错误(GH 52471) -
在带有
NA值的布尔ArrowDtype的Series.unique()中存在错误(GH 54667) -
对于非纳秒 dtype,
__iter__()和__getitem__()返回 python datetime 和 timedelta 对象的错误(GH 53326) -
对于具有多个块的
pyarrow.dictionary类型的pyarrow.chunked_array,factorize()返回不正确的唯一值的错误(GH 54844) -
将
ExtensionArray子类传递给dtype关键字时的错误。现在将引发UserWarning以鼓励传递实例而不是类(GH 31356,GH 54592) -
当列具有
pyarrow.ExtensionDtype并且具有pyarrow.dictionary类型的pyarrow.chunked_array时,DataFrame的 repr 无法工作的错误(GH 54063) -
掩码的 ExtensionDtypes 的
__from_arrow__方法(例如Float64Dtype,BooleanDtype)不接受pyarrow.null()类型的 PyArrow 数组的错误(GH 52223)
Styler
- 在调用
Styler子类中的重写方法时,在Styler._copy()中存在错误(GH 52728)
元数据
-
在
DataFrame.max()、DataFrame.min()、DataFrame.prod()、DataFrame.mean()、Series.mode()、DataFrame.median()、DataFrame.sem()、DataFrame.skew()、DataFrame.kurt()中修复了元数据传播 (GH 28283) -
在
DataFrame.squeeze()和DataFrame.describe()中修复了元数据传播 (GH 28283) -
在
DataFrame.std()中修复了元数据传播 (GH 28283)
其他
-
在
FloatingArray.__contains__中存在的 Bug,当存在NaN值时,NaN项错误地返回False(GH 52840) -
在
DataFrame和Series中存在的 Bug,当存在NaN值时,为复杂 dtype 的数据引发异常 (GH 53627) -
在
DatetimeIndex中存在的 Bug,其中当索引传递的repr带有时间时,不打印时间为午夜和非基于日的频率 (GH 53470) -
在
testing.assert_frame_equal()和testing.assert_series_equal()中存在的 Bug,现在为两个不相等的集合抛出断言错误 (GH 51727) -
Bug in
testing.assert_frame_equal()在被要求不检查索引类型时仍检查类别 dtypes (GH 52126) -
Bug in
api.interchange.from_dataframe()未遵守allow_copy参数(GH 54322) -
Bug in
api.interchange.from_dataframe()在从非 pandas 时区感知数据中包含空值时引发错误(GH 54287) -
Bug in
api.interchange.from_dataframe()在转换空的 DataFrame 对象时出现问题(GH 53155) -
Bug in
from_dummies()中,生成的Index与原始Index不匹配(GH 54300) -
Bug in
from_dummies()中,生成的数据始终为objectdtype 而不是列的 dtype (GH 54300) -
Bug in
DataFrameGroupBy.first(),DataFrameGroupBy.last(),SeriesGroupBy.first(), 和SeriesGroupBy.last()中,空组将返回np.nan而不是相应的ExtensionArrayNA 值(GH 39098) -
将整数的平均值转换回整数时,
DataFrame.pivot_table()中的错误会导致转换错误(GH 16676) -
当应该使用
ExtensionDtype推断fill_value时,DataFrame.reindex()中的错误错误地推断为objectdtype(GH 52586) -
当在具有单个
ExtensionDtype列的DataFrame上使用axis=1时,DataFrame.shift()中的错误会导致结果不正确(GH 53832) -
当传递
key时,Index.sort_values()中的错误会导致错误(GH 52764) -
当使用 method=”asfreq”时,
Series.align()、DataFrame.align()、Series.reindex()、DataFrame.reindex()、Series.interpolate()、DataFrame.interpolate()中的错误未能引发错误(GH 53620) -
当传递无效的
axis时,Series.argsort()中的错误未能引发错误(GH 54257) -
当对空系列提供可调用对象时,
Series.map()中的错误会导致返回的系列具有objectdtype。现在保留原始 dtype(GH 52384) -
当
deep=True时,Series.memory_usage()中的错误会导致对象系列的错误和返回值不正确,因为它没有考虑 GC 修正(GH 51858) -
在
period_range()中存在 bug,当未传递 freq 参数时,默认行为是不正确的(GH 53687) -
修正了
pandas._libs.json的错误__name__属性(GH 52898) ## 贡献者
共有 266 人为此版本贡献了补丁。名字后面带有“+”的人第一次为此贡献了补丁。
-
AG +
-
Aarni Koskela
-
Adrian D’Alessandro +
-
Adrien RUAULT +
-
Ahmad +
-
Aidos Kanapyanov +
-
Alex Malins
-
Alexander Seiler +
-
Ali Asgar +
-
Allison Kwan
-
Amanda Bizzinotto +
-
Andres Algaba +
-
Angela Seo +
-
Anirudh Hegde +
-
Antony Evmorfopoulos +
-
Anushka Bishnoi
-
ArnaudChanoine +
-
Artem Vorobyev +
-
Arya Sarkar +
-
Ashwin Srinath
-
Austin Au-Yeung +
-
Austin Burnett +
-
Bear +
-
Ben Mangold +
-
Bernardo Gameiro +
-
Boyd Kane +
-
Brayan Alexander Muñoz B +
-
Brock
-
Chetan0402 +
-
Chris Carini
-
ChristofKaufmann
-
Clark-W +
-
Conrad Mcgee Stocks
-
Corrie Bartelheimer +
-
Coulton Theuer +
-
D067751 +
-
Daniel Isaac
-
Daniele Nicolodi +
-
David Samuel +
-
David Seifert +
-
Dea Leon +
-
Dea María Léon
-
Deepyaman Datta
-
Denis Sapozhnikov +
-
Dharani Akurathi +
-
DimiGrammatikakis +
-
Dirk Ulbricht +
-
Dmitry Shemetov +
-
Dominik Berger
-
Efkan S. Goktepe +
-
Ege Özgüroğlu
-
Eli Schwartz
-
Erdi +
-
Fabrizio Primerano +
-
Facundo Batista +
-
Fangchen Li
-
Felipe Maion +
-
Francis +
-
Future Programmer +
-
Gabriel Kabbe +
-
Gaétan Ramet +
-
Gianluca Ficarelli
-
Godwill Agbehonou +
-
Guillaume Lemaitre
-
Guo Ci
-
Gustavo Vargas +
-
Hamidreza Sanaee +
-
HappyHorse +
-
Harald Husum +
-
Hugo van Kemenade
-
Ido Ronen +
-
Irv Lustig
-
JHM Darbyshire
-
JHM Darbyshire(iMac)
-
JJ +
-
Jarrod Millman
-
Jay +
-
Jeff Reback
-
Jessica Greene +
-
Jiawei Zhang +
-
Jinli Xiao +
-
Joanna Ge +
-
Jona Sassenhagen +
-
Jonas Haag
-
Joris Van den Bossche
-
Joshua Shew +
-
Julian Badillo
-
Julian Ortiz +
-
Julien Palard +
-
Justin Tyson +
-
Justus Magin
-
Kabiir Krishna +
-
Kang Su Min
-
Ketu Patel +
-
Kevin +
-
Kevin Anderson
-
Kevin Jan Anker
-
Kevin Klein +
-
Kevin Sheppard
-
Kostya Farber
-
LM +
-
Lars Lien Ankile +
-
Lawrence Mitchell
-
Liwei Cai +
-
Loic Diridollou
-
Luciana Solorzano +
-
Luke Manley
-
Lumberbot(又名 Jack)
-
Marat Kopytjuk +
-
Marc Garcia
-
Marco Edward Gorelli
-
MarcoGorelli
-
Maria Telenczuk +
-
MarvinGravert +
-
Mateusz Sokół +
-
Matt Richards
-
Matthew Barber +
-
Matthew Roeschke
-
Matus Valo +
-
Mia Reimer +
-
Michael Terry +
-
Michael Tiemann +
-
Milad Maani Jou +
-
Miles Cranmer +
-
MirijaH +
-
Miyuu +
-
Natalia Mokeeva
-
Nathan Goldbaum +
-
Nicklaus Roach +
-
Nicolas Camenisch +
-
Nikolay Boev +
-
Nirav
-
Nishu Choudhary
-
Noa Tamir
-
Noy Hanan +
-
Numan +
-
Numan Ijaz +
-
Omar Elbaz +
-
Pandas 开发团队
-
Parfait Gasana
-
Parthi
-
Patrick Hoefler
-
Patrick Schleiter +
-
Pawel Kranzberg +
-
Philip
-
Philip Meier +
-
Pranav Saibhushan Ravuri
-
PrathumP +
-
Rahul Siloniya +
-
Rajasvi Vinayak +
-
Rajat Subhra Mukherjee +
-
Ralf Gommers
-
RaphSku
-
Rebecca Chen +
-
Renato Cotrim Maciel +
-
Reza(Milad)Maanijou +
-
Richard Shadrach
-
Rithik Reddy +
-
Robert Luce +
-
Ronalido +
-
Rylie Wei +
-
SOUMYADIP MAL +
-
Sanjith Chockan +
-
Sayed Qaiser Ali +
-
Scott Harp +
-
Se +
-
Shashwat Agrawal
-
Simar Bassi +
-
Simon Brugman +
-
Simon Hawkins
-
Simon Høxbro Hansen
-
Snorf Yang +
-
Sortofamudkip +
-
Stefan Krawczyk
-
Stefanie Molin
-
Stefanie Senger
-
Stelios Petrakis +
-
Stijn Van Hoey
-
Sven
-
Sylvain MARIE
-
Sylvain Marié
-
Terji Petersen
-
Thierry Moisan
-
Thomas
-
Thomas A Caswell
-
Thomas Grainger
-
Thomas Li
-
Thomas Vranken +
-
Tianye Song +
-
Tim Hoffmann
-
Tim Loderhose +
-
Tim Swast
-
Timon Jurschitsch +
-
Tolker-KU +
-
Tomas Pavlik +
-
Toroi +
-
Torsten Wörtwein
-
Travis Gibbs +
-
Umberto Fasci +
-
Valerii +
-
VanMyHu +
-
Victor Momodu +
-
Vijay Vaidyanathan +
-
VomV +
-
William Andrea
-
William Ayd
-
Wolf Behrenhoff +
-
Xiao Yuan
-
Yao Xiao
-
Yasin Tatar
-
Yaxin Li +
-
Yi Wei +
-
Yulia +
-
Yusharth Singh +
-
Zach Breger +
-
Zhengbo Wang
-
abokey1 +
-
ahmad2901 +
-
assafam +
-
auderson
-
august-tengland +
-
bunardsheng +
-
cmmck +
-
cnguyen-03 +
-
coco +
-
dependabot[bot]
-
giplessis +
-
github-actions[bot]
-
gmaiwald +
-
gmollard +
-
jbrockmendel
-
kathleenhang
-
kevx82 +
-
lia2710 +
-
liang3zy22 +
-
ltartaro +
-
lusolorz +
-
m-ganko +
-
mKlepsch +
-
mattkeanny +
-
mrastgoo +
-
nabdoni +
-
omar-elbaz +
-
paulreece +
-
penelopeysm +
-
potap75 +
-
pre-commit-ci[bot] +
-
raanasn +
-
raj-thapa +
-
ramvikrams +
-
rebecca-palmer
-
reddyrg1 +
-
rmhowe425 +
-
segatrade +
-
shteken +
-
sweisss +
-
taytzehao
-
tntmatthews +
-
tpaxman +
-
tzehaoo +
-
v-mcoutinho +
-
wcgonzal +
-
yonashub
-
yusharth +
-
Ádám Lippai
-
Štěpán Műller + ## 增强功能
PyArrow 将在 pandas 3.0 中成为必需依赖
PyArrow 将成为 pandas 3.0 版本的必需依赖。此决定基于 PDEP 10。
这将使得对 pandas 用户极其有益的更多变化成为可能,包括但不限于:
-
默认情况下将字符串推断为 PyArrow 支持的字符串,从而显著减少内存占用并实现巨大的性能提升。
-
默认情况下使用 PyArrow 推断更复杂的数据类型,如
Decimal、lists、bytes、structured data等。 -
与依赖于 Apache Arrow 的其他库更好地互操作。
我们正在这里收集对此决定的反馈。 ### 默认情况下避免使用 NumPy 对象数据类型存储字符串
以前,默认情况下,所有字符串都存储在 NumPy 对象 dtype 的列中。此版本引入了一个选项 future.infer_string,该选项将所有字符串推断为 PyArrow 支持的字符串,并且 dtype 为 "string[pyarrow_numpy]"。这是一种新的字符串 dtype 实现,它遵循 NumPy 在比较操作中的语义,并将 np.nan 作为缺失值指示符返回。设置该选项还将推断 dtype "string" 为 StringDtype,存储设置为 "pyarrow_numpy",忽略选项 mode.string_storage 后面的值。
此选项仅在安装了 PyArrow 时有效。PyArrow 支持的字符串具有显着减少的内存占用和与 NumPy 对象相比提供了很大的性能改进(GH 54430)。
可以通过以下方式启用该选项:
pd.options.future.infer_string = True
这种行为将在 pandas 3.0 中成为默认行为。### DataFrame reductions 保留扩展的 dtypes
在之前的 pandas 版本中,DataFrame reductions(DataFrame.sum() DataFrame.mean() 等)的结果具有 NumPy 的 dtypes,即使 DataFrame 是扩展的 dtypes。现在,当对具有共同 dtype 的 DataFrame 列进行缩减时,Pandas 可以保留 dtypes(GH 52788)。
旧行为
In [1]: df = pd.DataFrame({"a": [1, 1, 2, 1], "b": [np.nan, 2.0, 3.0, 4.0]}, dtype="Int64")
In [2]: df.sum()
Out[2]:
a 5
b 9
dtype: int64
In [3]: df = df.astype("int64[pyarrow]")
In [4]: df.sum()
Out[4]:
a 5
b 9
dtype: int64
新行为
In [1]: df = pd.DataFrame({"a": [1, 1, 2, 1], "b": [np.nan, 2.0, 3.0, 4.0]}, dtype="Int64")
In [2]: df.sum()
Out[2]:
a 5
b 9
dtype: Int64
In [3]: df = df.astype("int64[pyarrow]")
In [4]: df.sum()
Out[4]:
a 5
b 9
dtype: int64[pyarrow]
注意,dtype 现在分别是掩码 dtype 和 PyArrow dtype,而以前是 NumPy 整数 dtype。
为了允许 DataFrame reductions 保留扩展的 dtypes,ExtensionArray._reduce() 已经得到一个新的关键字参数 keepdims。调用 ExtensionArray._reduce(),带有 keepdims=True 应该返回一个沿着缩减轴长度为 1 的数组。为了保持向后兼容性,该参数不是必需的,但将来可能会变得必需。如果在签名中找不到该参数,则 DataFrame reductions 无法保留扩展的 dtypes。此外,如果未找到参数,将发出 FutureWarning,并且类型检查器如 mypy 可能会抱怨签名与 ExtensionArray._reduce() 不兼容。### 写时复制改进
-
当
func在Series中原地修改时,Series.transform()不尊重写时复制(GH 53747)。 -
调用
Index.values()现在将返回一个只读的 NumPy 数组(GH 53704)。 -
将
Series设置到DataFrame现在创建惰性副本而不是深层副本 (GH 53142) -
当从索引对象字典构造 DataFrame 并指定
copy=False时,DataFrame构造函数现在将使用这些索引对象的惰性副本作为 DataFrame 的列(GH 52947) -
对于 Series 或 DataFrame 的浅层复制(
df.copy(deep=False)),现在还将返回行/列的浅层副本Index对象,而不仅仅是数据的浅层副本,即结果的索引不再相同(df.copy(deep=False).index is df.index不再为 True)(GH 53721) -
DataFrame.head()和DataFrame.tail()现在将返回深层副本 (GH 54011) -
在
DataFrame.eval()中添加惰性复制机制 (GH 53746) -
当启用写时复制时,尝试在临时列选择上进行就地操作(例如,
df["a"].fillna(100, inplace=True))现在将始终引发警告。在这种模式下,像这样就地操作永远不会起作用,因为选择行为像临时副本一样。对以下内容适用:-
DataFrame.update / Series.update
-
DataFrame.fillna / Series.fillna
-
DataFrame.replace / Series.replace
-
DataFrame.clip / Series.clip
-
DataFrame.where / Series.where
-
DataFrame.mask / Series.mask
-
DataFrame.interpolate / Series.interpolate
-
DataFrame.ffill / Series.ffill
-
DataFrame.bfill / Series.bfill ### 新的
DataFrame.map()方法和对 ExtensionArrays 的支持
-
DataFrame.map() 已添加,DataFrame.applymap() 已被弃用。 DataFrame.map() 具有与 DataFrame.applymap() 相同的功能,但新名称更好地传达了这是 Series.map() 的 DataFrame 版本(GH 52353)。
当给定一个可调用对象时,Series.map() 将可调用对象应用于 Series 的所有元素。 类似地,DataFrame.map() 将可调用对象应用于 DataFrame 的所有元素,而 Index.map() 将可调用对象应用于 Index 的所有元素。
经常情况下,不希望将可调用对象应用于数组的类似 nan 的值,为了避免这种情况,可以使用 map 方法调用 na_action="ignore",即 ser.map(func, na_action="ignore")。 然而,na_action="ignore" 没有被实现在许多 ExtensionArray 和 Index 类型中,并且 na_action="ignore" 对于除了可空数值类型(即具有 dtype Int64 等)之外的任何 ExtensionArray 子类都不起作用。
na_action="ignore" 现在适用于所有数组类型(GH 52219, GH 51645, GH 51809, GH 51936, GH 52033; GH 52096)。
先前行为:
In [1]: ser = pd.Series(["a", "b", np.nan], dtype="category")
In [2]: ser.map(str.upper, na_action="ignore")
NotImplementedError
In [3]: df = pd.DataFrame(ser)
In [4]: df.applymap(str.upper, na_action="ignore") # worked for DataFrame
0
0 A
1 B
2 NaN
In [5]: idx = pd.Index(ser)
In [6]: idx.map(str.upper, na_action="ignore")
TypeError: CategoricalIndex.map() got an unexpected keyword argument 'na_action'
新行为:
In [5]: ser = pd.Series(["a", "b", np.nan], dtype="category")
In [6]: ser.map(str.upper, na_action="ignore")
Out[6]:
0 A
1 B
2 NaN
dtype: category
Categories (2, object): ['A', 'B']
In [7]: df = pd.DataFrame(ser)
In [8]: df.map(str.upper, na_action="ignore")
Out[8]:
0
0 A
1 B
2 NaN
In [9]: idx = pd.Index(ser)
In [10]: idx.map(str.upper, na_action="ignore")
Out[10]: CategoricalIndex(['A', 'B', nan], categories=['A', 'B'], ordered=False, dtype='category')
还要注意,Categorical.map() 默认地将其na_action设置为"ignore"。这已经被弃用,Categorical.map() 的默认值将更改为na_action=None,与所有其他数组类型一致。 ### DataFrame.stack() 的新实现
pandas 已经重新实现了 DataFrame.stack()。要使用新的实现,请传递参数 future_stack=True。这将在 pandas 3.0 中成为唯一的选项。
前一个实现有两个主要的行为缺陷。
-
以前的实现会不必要地在结果中引入 NA 值。用户可以通过传递
dropna=True(默认值)自动删除 NA 值,但这样做也可能会从输入中删除结果中存在的 NA 值。请参见下面的示例。 -
以前的实现中使用了
sort=True(默认值),有时会对结果索引的部分进行排序,有时则不会。如果输入的列 不是MultiIndex,那么结果索引将永远不会被排序。如果列是MultiIndex,那么在大多数情况下,来自堆叠列级别的结果索引的级别会被排序。在罕见的情况下,这样的级别将以非标准顺序进行排序,这取决于列的创建方式。
新实现(future_stack=True)在堆叠多个级别时不再会不必要地引入 NA 值,并且永远不会排序。因此,当使用future_stack=True时,参数dropna和sort不被使用,并且在使用future_stack=True时必须保持未指定状态。这些参数将在下一个主要版本中被移除。
In [11]: columns = pd.MultiIndex.from_tuples([("B", "d"), ("A", "c")])
In [12]: df = pd.DataFrame([[0, 2], [1, 3]], index=["z", "y"], columns=columns)
In [13]: df
Out[13]:
B A
d c
z 0 2
y 1 3
在以前的版本(future_stack=False)中,默认值dropna=True会删除不必要引入的 NA 值,但仍会在此过程中强制将 dtype 转换为float64。在新版本中,不会引入任何 NA 值,因此不会强制转换 dtype。
In [14]: df.stack([0, 1], future_stack=False, dropna=True)
Out[14]:
z A c 2.0
B d 0.0
y A c 3.0
B d 1.0
dtype: float64
In [15]: df.stack([0, 1], future_stack=True)
Out[15]:
z B d 0
A c 2
y B d 1
A c 3
dtype: int64
如果输入包含 NA 值,以前的版本会使用dropna=True将其删除,或者使用dropna=False引入新的 NA 值。新版本保留输入中的所有值。
In [16]: df = pd.DataFrame([[0, 2], [np.nan, np.nan]], columns=columns)
In [17]: df
Out[17]:
B A
d c
0 0.0 2.0
1 NaN NaN
In [18]: df.stack([0, 1], future_stack=False, dropna=True)
Out[18]:
0 A c 2.0
B d 0.0
dtype: float64
In [19]: df.stack([0, 1], future_stack=False, dropna=False)
Out[19]:
0 A d NaN
c 2.0
B d 0.0
c NaN
1 A d NaN
c NaN
B d NaN
c NaN
dtype: float64
In [20]: df.stack([0, 1], future_stack=True)
Out[20]:
0 B d 0.0
A c 2.0
1 B d NaN
A c NaN
dtype: float64
``` ### 其他增强
+ `Series.ffill()` 和 `Series.bfill()` 现在支持具有 `IntervalDtype` 的对象([GH 54247](https://github.com/pandas-dev/pandas/issues/54247))
+ 在`read_parquet()`中添加了`filters`参数以过滤数据,与`engines`兼容 ([GH 53212](https://github.com/pandas-dev/pandas/issues/53212))
+ `Categorical.map()`和`CategoricalIndex.map()`现在有一个`na_action`参数。`Categorical.map()`隐式地对`na_action`使用了`"ignore"`的默认值。这已经正式被弃用,并将来会更改为`None`。还请注意,`Series.map()`的默认`na_action=None`,并且对具有分类数据的系列的调用现在将使用`na_action=None`,除非显式设置为其他值 ([GH 44279](https://github.com/pandas-dev/pandas/issues/44279))
+ `api.extensions.ExtensionArray`现在有一个`map()`方法 ([GH 51809](https://github.com/pandas-dev/pandas/issues/51809))
+ `DataFrame.applymap()`现在使用底层`api.extensions.ExtensionArray`实例的`map()`方法 ([GH 52219](https://github.com/pandas-dev/pandas/issues/52219))
+ `MultiIndex.sort_values()`现在支持`na_position` ([GH 51612](https://github.com/pandas-dev/pandas/issues/51612))
+ `MultiIndex.sortlevel()`和`Index.sortlevel()`新增了一个`na_position`关键字 ([GH 51612](https://github.com/pandas-dev/pandas/issues/51612))
+ `arrays.DatetimeArray.map()`、`arrays.TimedeltaArray.map()`和`arrays.PeriodArray.map()`现在可以接受一个`na_action`参数 ([GH 51644](https://github.com/pandas-dev/pandas/issues/51644))
+ `arrays.SparseArray.map()`现在支持`na_action` ([GH 52096](https://github.com/pandas-dev/pandas/issues/52096)).
+ `pandas.read_html()`现在在使用 URL 时支持`storage_options`关键字,允许用户向出站 HTTP 请求添加头部 ([GH 49944](https://github.com/pandas-dev/pandas/issues/49944))
+ 添加了`Index.diff()`和`Index.round()` ([GH 19708](https://github.com/pandas-dev/pandas/issues/19708))
+ 将`"latex-math"`作为`Styler`的`escape`参数的选项添加,这样在格式化期间将不会转义`"\("`和`"\)"`之间的所有字符 ([GH 51903](https://github.com/pandas-dev/pandas/issues/51903))
+ 将类别的 dtype 添加到 `CategoricalDtype` 的 `repr` 信息中 ([GH 52179](https://github.com/pandas-dev/pandas/issues/52179))
+ 将 `engine_kwargs` 参数添加到 `read_excel()` 中 ([GH 52214](https://github.com/pandas-dev/pandas/issues/52214))
+ 在新的子模块 `pandas.api.typing` 中将用于类型提示的类添加到公共 API 中 ([GH 48577](https://github.com/pandas-dev/pandas/issues/48577))
+ 实现了`Series.dt.is_month_start`,`Series.dt.is_month_end`,`Series.dt.is_year_start`,`Series.dt.is_year_end`,`Series.dt.is_quarter_start`,`Series.dt.is_quarter_end`,`Series.dt.days_in_month`,`Series.dt.unit`,`Series.dt.normalize`,`Series.dt.day_name()`,`Series.dt.month_name()`,`Series.dt.tz_convert()`,用于 `ArrowDtype` 的 `pyarrow.timestamp` ([GH 52388](https://github.com/pandas-dev/pandas/issues/52388), [GH 51718](https://github.com/pandas-dev/pandas/issues/51718))
+ `DataFrameGroupBy.agg()` 和 `DataFrameGroupBy.transform()` 现在在索引不是 `MultiIndex` 时支持按多个键分组,`engine="numba"`([GH 53486](https://github.com/pandas-dev/pandas/issues/53486))
+ `SeriesGroupBy.agg()` 和 `DataFrameGroupBy.agg()` 现在支持将多个函数传入 `engine="numba"`([GH 53486](https://github.com/pandas-dev/pandas/issues/53486))
+ `SeriesGroupBy.transform()` 和 `DataFrameGroupBy.transform()` 现在支持将字符串作为 `engine="numba"` 的函数传入([GH 53579](https://github.com/pandas-dev/pandas/issues/53579))
+ `DataFrame.stack()` 新增了 `sort` 参数,用于指定结果的 `MultiIndex` 索引是否排序([GH 15105](https://github.com/pandas-dev/pandas/issues/15105))
+ `DataFrame.unstack()` 新增了 `sort` 参数,用于指定结果的 `MultiIndex` 索引是否排序([GH 15105](https://github.com/pandas-dev/pandas/issues/15105))
+ `Series.explode()` 现在支持 PyArrow 支持的列表类型([GH 53602](https://github.com/pandas-dev/pandas/issues/53602))
+ `Series.str.join()` 现在支持 `ArrowDtype(pa.string())`([GH 53646](https://github.com/pandas-dev/pandas/issues/53646))
+ 在 `Categorical.from_codes()` 中添加了 `validate` 参数([GH 50975](https://github.com/pandas-dev/pandas/issues/50975))
+ 添加了`ExtensionArray.interpolate()`,被`Series.interpolate()`和`DataFrame.interpolate()`使用([GH 53659](https://github.com/pandas-dev/pandas/issues/53659))
+ 向`DataFrame.to_excel()`添加了`engine_kwargs`参数([GH 53220](https://github.com/pandas-dev/pandas/issues/53220))
+ 实现了`api.interchange.from_dataframe()`用于`DatetimeTZDtype`([GH 54239](https://github.com/pandas-dev/pandas/issues/54239))
+ 在`DatetimeTZDtype`上实现了`__from_arrow__`([GH 52201](https://github.com/pandas-dev/pandas/issues/52201))
+ 实现了`__pandas_priority__`,允许自定义类型优先于`DataFrame`、`Series`、`Index`或`ExtensionArray`进行算术运算,请参阅开发人员指南([GH 48347](https://github.com/pandas-dev/pandas/issues/48347))
+ 当使用`DataFrame.merge()`时,改进了具有不兼容列时的错误消息([GH 51861](https://github.com/pandas-dev/pandas/issues/51861))
+ 通过`DataFrame.isetitem()`在设置`DataFrame`时,当列数错误时改进错误消息([GH 51701](https://github.com/pandas-dev/pandas/issues/51701))
+ 在使用`DataFrame.to_json()`时,改进了处理���兼容`index`和`orient`参数时的错误处理([GH 52143](https://github.com/pandas-dev/pandas/issues/52143))
+ 在创建具有空数据(0 行)、无索引和不正确列数的 DataFrame 时,改进了错误消息([GH 52084](https://github.com/pandas-dev/pandas/issues/52084))
+ 当向`VariableOffsetWindowIndexer`)
+ 允许`DataFrame.to_feather()`和非字符串列名([GH 51787](https://github.com/pandas-dev/pandas/issues/51787))
+ 向`Series.apply()``](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply")添加了一个新参数`by_row`。当设置为`False`时,提供的可调用对象将始终对整个 Series 或 DataFrame 进行操作([GH 53400](https://github.com/pandas-dev/pandas/issues/53400),[GH 53601](https://github.com/pandas-dev/pandas/issues/53601))
+ `DataFrame.shift()``](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift")现在允许通过提供一系列周期来进行多周期的偏移([GH 44424](https://github.com/pandas-dev/pandas/issues/44424))
+ 使用`numba`进行分组聚合(如`DataFrameGroupBy.sum()`)
+ 当`DataFrameGroupBy.agg()`)
+ 许多读取/写入函数,如`DataFrame.to_pickle()``](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"),支持将压缩参数转发给`lzma.LZMAFile`([GH 52979](https://github.com/pandas-dev/pandas/issues/52979))
+ 缩减函数 `Series.argmax()`、`Series.argmin()`、`Series.idxmax()`、`Series.idxmin()`、`Index.argmax()`、`Index.argmin()`、`DataFrame.idxmax()`、`DataFrame.idxmin()` 现在支持对象数据类型([GH 4279](https://github.com/pandas-dev/pandas/issues/4279),[GH 18021](https://github.com/pandas-dev/pandas/issues/18021),[GH 40685](https://github.com/pandas-dev/pandas/issues/40685),[GH 43697](https://github.com/pandas-dev/pandas/issues/43697))
+ `DataFrame.to_parquet()` 和 `read_parquet()` 现在分别写入和读取 `attrs`([GH 54346](https://github.com/pandas-dev/pandas/issues/54346))
+ `Index.all()` 和 `Index.any()` 在浮点数据类型和 timedelta64 数据类型中不再引发 `TypeError`,与 `Series.all()` 和 `Series.any()` 的行为相匹配([GH 54566](https://github.com/pandas-dev/pandas/issues/54566))
+ `Series.cummax()`、`Series.cummin()` 和 `Series.cumprod()` 现在支持 pyarrow 版本 13.0 及以上的数据类型([GH 52085](https://github.com/pandas-dev/pandas/issues/52085))
+ 增加对 DataFrame Consortium Standard 的支持([GH 54383](https://github.com/pandas-dev/pandas/issues/54383))
+ 在`DataFrameGroupBy.quantile()`和`SeriesGroupBy.quantile()`中的性能改进([GH 51722](https://github.com/pandas-dev/pandas/issues/51722))。
+ PyArrow 支持的整数数据类型现在支持位操作([GH 54495](https://github.com/pandas-dev/pandas/issues/54495))### PyArrow 将成为 pandas 3.0 的必需依赖项
[PyArrow](https://arrow.apache.org/docs/python/index.html)将从 pandas 3.0 开始成为 pandas 的必需依赖项。这一决定是基于[PDEP 10](https://pandas.pydata.org/pdeps/0010-required-pyarrow-dependency.html)。
这将使得更多对 pandas 用户极其有益的更改成为可能,包括但不限于:
+ 默认情况下将字符串推断为 PyArrow 支持的字符串,从而显著减少内存占用并实现巨大的性能改进。
+ 默认情况下,使用 PyArrow 推断更复杂的数据类型,如`Decimal`、`lists`、`bytes`、`structured data`等。
+ 与依赖于 Apache Arrow 的其他库更好地实现互操作性。
我们正在[此处](https://github.com/pandas-dev/pandas/issues/54466)收集有关此决定的反馈。
### 默认情况下避免使用 NumPy 对象数据类型存储字符串
以前,默认情况下,所有字符串都存储在具有 NumPy 对象数据类型的列中。此版本引入了一个选项`future.infer_string`,将所有字符串推断为 PyArrow 支持的字符串,数据类型为`"string[pyarrow_numpy]"`。这是一种遵循 NumPy 语义的新字符串数据类型实现,在比较操作中将返回`np.nan`作为缺失值指示符。设置该选项还将推断数据类型`"string"`为`StringDtype`,存储设置为`"pyarrow_numpy"`,忽略选项`mode.string_storage`后面的值。
仅当安装了 PyArrow 时,此选项才有效。PyArrow 支持的字符串具有显著减少的内存占用,并与 NumPy 对象相比提供了很大的性能改进([GH 54430](https://github.com/pandas-dev/pandas/issues/54430))。
可以通过以下方式启用该选项:
```py
pd.options.future.infer_string = True
这种行为将成为 pandas 3.0 的默认设置。
DataFrame reductions 保留扩展数据类型
在 pandas 的早期版本中,DataFrame 缩减的结果(DataFrame.sum() DataFrame.mean() 等)即使 DataFrame 是扩展数据类型,也具有 NumPy 数据类型。现在,当对具有共同数据类型的 DataFrame 列进行缩减时,Pandas 可以保留数据类型(GH 52788)。
旧行为
In [1]: df = pd.DataFrame({"a": [1, 1, 2, 1], "b": [np.nan, 2.0, 3.0, 4.0]}, dtype="Int64")
In [2]: df.sum()
Out[2]:
a 5
b 9
dtype: int64
In [3]: df = df.astype("int64[pyarrow]")
In [4]: df.sum()
Out[4]:
a 5
b 9
dtype: int64
新行为
In [1]: df = pd.DataFrame({"a": [1, 1, 2, 1], "b": [np.nan, 2.0, 3.0, 4.0]}, dtype="Int64")
In [2]: df.sum()
Out[2]:
a 5
b 9
dtype: Int64
In [3]: df = df.astype("int64[pyarrow]")
In [4]: df.sum()
Out[4]:
a 5
b 9
dtype: int64[pyarrow]
注意现在 dtype 分别是遮罩 dtype 和 PyArrow dtype,而以前是 NumPy 整数 dtype。
为了允许 DataFrame 的缩减保留扩展的数据类型,ExtensionArray._reduce() 添加了一个新的关键字参数 keepdims。调用带有 keepdims=True 的 ExtensionArray._reduce() 应该返回沿着缩减轴长度为 1 的数组。为了保持向后兼容性,该参数不是必需的,但将来可能会变成必需的。如果在签名中找不到该参数,则 DataFrame 的缩减将无法保留扩展的数据类型。此外,如果找不到该参数,将发出 FutureWarning,并且像 mypy 这样的类型检查器可能会抱怨签名与 ExtensionArray._reduce() 不兼容。
Copy-on-Write 改进
-
当
func原地修改Series时,Series.transform()不尊重 Copy-on-Write(GH 53747) -
调用
Index.values()现在将返回一个只读的 NumPy 数组(GH 53704)。 -
将一个
Series设置到一个DataFrame现在创建一个惰性副本而不是深度副本(GH 53142)。 -
当使用字典的 Index 对象构造 DataFrame 并指定
copy=False时,DataFrame构造函数现在将使用这些 Index 对象的惰性拷贝作为 DataFrame 的列 (GH 52947) -
对 Series 或 DataFrame 的浅拷贝 (
df.copy(deep=False)) 现在还将返回行/列的浅拷贝Index对象而不仅仅是数据的浅拷贝,即结果的索引不再相同(df.copy(deep=False).index is df.index不再为 True) (GH 53721) -
DataFrame.head()和DataFrame.tail()现在将返回深拷贝(GH 54011) -
向
DataFrame.eval()添加惰性拷贝机制 (GH 53746) -
在临时列选择上尝试原地操作(例如,
df["a"].fillna(100, inplace=True))现在在启用写时复制时始终会引发警告。在这种模式下,像这样原地操作永远不会起作用,因为选择行为像一个临时副本。这对以下情况成立:-
DataFrame.update / Series.update
-
DataFrame.fillna / Series.fillna
-
DataFrame.replace / Series.replace
-
DataFrame.clip / Series.clip
-
DataFrame.where / Series.where
-
DataFrame.mask / Series.mask
-
DataFrame.interpolate / Series.interpolate
-
DataFrame.ffill / Series.ffill
-
DataFrame.bfill / Series.bfill
-
新的 DataFrame.map() 方法和对 ExtensionArrays 的支持
已添加 DataFrame.map() 并且已弃用 DataFrame.applymap()。 DataFrame.map() 具有与 DataFrame.applymap() 相同的功能,但新名称更好地传达了这是 DataFrame 版本的 Series.map() (GH 52353)。
给定一个 callable,Series.map() 将 callable 应用于 Series 的所有元素。类似地,DataFrame.map() 将 callable 应用于 DataFrame 的所有元素,而 Index.map() 将 callable 应用于 Index 的所有元素。
经常情况下,不希望将 callable 应用于数组的类似 nan 的值,为了避免这样做,可以使用 map 方法调用 na_action="ignore",即 ser.map(func, na_action="ignore")。然而,na_action="ignore" 并未为许多 ExtensionArray 和 Index 类型实现,na_action="ignore" 对于任何 ExtensionArray 子类都不起作用,除了可空的数值类型(即具有 dtype Int64 等)。
现在 na_action="ignore" 对所有数组类型都起作用 (GH 52219, GH 51645, GH 51809, GH 51936, GH 52033; GH 52096)。
之前的行为:
In [1]: ser = pd.Series(["a", "b", np.nan], dtype="category")
In [2]: ser.map(str.upper, na_action="ignore")
NotImplementedError
In [3]: df = pd.DataFrame(ser)
In [4]: df.applymap(str.upper, na_action="ignore") # worked for DataFrame
0
0 A
1 B
2 NaN
In [5]: idx = pd.Index(ser)
In [6]: idx.map(str.upper, na_action="ignore")
TypeError: CategoricalIndex.map() got an unexpected keyword argument 'na_action'
新的行为:
In [5]: ser = pd.Series(["a", "b", np.nan], dtype="category")
In [6]: ser.map(str.upper, na_action="ignore")
Out[6]:
0 A
1 B
2 NaN
dtype: category
Categories (2, object): ['A', 'B']
In [7]: df = pd.DataFrame(ser)
In [8]: df.map(str.upper, na_action="ignore")
Out[8]:
0
0 A
1 B
2 NaN
In [9]: idx = pd.Index(ser)
In [10]: idx.map(str.upper, na_action="ignore")
Out[10]: CategoricalIndex(['A', 'B', nan], categories=['A', 'B'], ordered=False, dtype='category')
此外,注意 Categorical.map() 默认情况下隐式地将其 na_action 设置为 "ignore"。这已被弃用,Categorical.map() 的默认值将更改为 na_action=None,与所有其他数组类型保持一致。
DataFrame.stack() 的新实现
pandas 已重新实现了 DataFrame.stack()。要使用新实现,传递参数 future_stack=True。这将成为 pandas 3.0 中的唯一选项。
之前的实现有两个主要的行为缺点。
-
之前的实现会在结果中不必要地引入 NA 值。用户可以通过传递
dropna=True(默认值)自动删除 NA 值,但这样做也可能从输入中删除结果中存在的 NA 值。请参见下面的示例。 -
具有
sort=True(默认)的先前实现有时会对结果索引的一部分进行排序,有时则不会。如果输入的列不是MultiIndex,那么结果索引永远不会被排序。如果列是MultiIndex,那么在大多数情况下,来自堆叠列级别的结果索引的级别会被排序。在罕见情况下,这样的级别会按非标准顺序排序,这取决于列是如何创建的。
新实现(future_stack=True)在堆叠多个级别时将不再不必要地引入 NA 值,并且永远不会排序。因此,在使用 future_stack=True 时,不使用参数 dropna 和 sort,必须保持未指定。这些参数将在下一个主要版本中被移除。
In [11]: columns = pd.MultiIndex.from_tuples([("B", "d"), ("A", "c")])
In [12]: df = pd.DataFrame([[0, 2], [1, 3]], index=["z", "y"], columns=columns)
In [13]: df
Out[13]:
B A
d c
z 0 2
y 1 3
在先前版本中(future_stack=False),dropna=True 的默认值会删除不必要引入的 NA 值,但仍会在过程中强制将 dtype 转换为 float64。在新版本中,不会引入任何 NA 值,因此不会强制转换 dtype。
In [14]: df.stack([0, 1], future_stack=False, dropna=True)
Out[14]:
z A c 2.0
B d 0.0
y A c 3.0
B d 1.0
dtype: float64
In [15]: df.stack([0, 1], future_stack=True)
Out[15]:
z B d 0
A c 2
y B d 1
A c 3
dtype: int64
如果输入包含 NA 值,先前版本会使用 dropna=True 删除这些值,或者使用 dropna=False 引入新的 NA 值。新版本将保留来自输入的所有值。
In [16]: df = pd.DataFrame([[0, 2], [np.nan, np.nan]], columns=columns)
In [17]: df
Out[17]:
B A
d c
0 0.0 2.0
1 NaN NaN
In [18]: df.stack([0, 1], future_stack=False, dropna=True)
Out[18]:
0 A c 2.0
B d 0.0
dtype: float64
In [19]: df.stack([0, 1], future_stack=False, dropna=False)
Out[19]:
0 A d NaN
c 2.0
B d 0.0
c NaN
1 A d NaN
c NaN
B d NaN
c NaN
dtype: float64
In [20]: df.stack([0, 1], future_stack=True)
Out[20]:
0 B d 0.0
A c 2.0
1 B d NaN
A c NaN
dtype: float64
其他增强
-
Series.ffill()和Series.bfill()现在支持具有IntervalDtype的对象(GH 54247) -
向
read_parquet()添加了filters参数以过滤数据,与两种engines兼容(GH 53212) -
Categorical.map()和CategoricalIndex.map()现在具有na_action参数。Categorical.map()对于na_action隐式地具有默认值"ignore"。这已正式被弃用,并将在未来更改为None。还要注意,Series.map()的默认na_action=None,对具有分类数据的系列的调用现在将使用na_action=None,除非另有明确设置(GH 44279) -
api.extensions.ExtensionArray现在有一个map()方法(GH 51809) -
DataFrame.applymap()现在使用底层api.extensions.ExtensionArray实例的map()方法(GH 52219) -
MultiIndex.sort_values()现在支持na_position(GH 51612) -
MultiIndex.sortlevel()和Index.sortlevel()增加了一个新的关键字na_position(GH 51612) -
arrays.DatetimeArray.map()、arrays.TimedeltaArray.map()和arrays.PeriodArray.map()现在可以接受na_action参数(GH 51644) -
arrays.SparseArray.map()现在支持na_action(GH 52096) -
当与 URL 一起使用时,
pandas.read_html()现在支持storage_options关键字,允许用户向出站 HTTP 请求添加标头(GH 49944) -
添加了
Index.diff()和Index.round()(GH 19708) -
将
"latex-math"添加为Styler的escape参数的选项,这样在格式化期间不会转义"\("和"\)"之间的所有字符(GH 51903) -
将类别的 dtype 添加到
CategoricalDtype的repr信息中(GH 52179) -
向
read_excel()添加了engine_kwargs参数(GH 52214) -
在新的子模块
pandas.api.typing中向公共 API 添加了用于类型提示的类(GH 48577) -
实现了
Series.dt.is_month_start,Series.dt.is_month_end,Series.dt.is_year_start,Series.dt.is_year_end,Series.dt.is_quarter_start,Series.dt.is_quarter_end,Series.dt.days_in_month,Series.dt.unit,Series.dt.normalize,Series.dt.day_name(),Series.dt.month_name(),Series.dt.tz_convert()用于带有pyarrow.timestamp的ArrowDtype(GH 52388, GH 51718) -
DataFrameGroupBy.agg()和DataFrameGroupBy.transform()现在在索引不是MultiIndex的情况下支持按多个键分组,用于engine="numba"(GH 53486) -
SeriesGroupBy.agg()和DataFrameGroupBy.agg()现在支持传入多个函数以供engine="numba"使用(GH 53486) -
SeriesGroupBy.transform()和DataFrameGroupBy.transform()现在支持传入字符串作为engine="numba"的函数(GH 53579) -
DataFrame.stack()添加了sort关键字,用于指定生成的MultiIndex索引级别是否排序(GH 15105) -
DataFrame.unstack()添加了sort关键字,用于指定生成的MultiIndex索引级别是否排序(GH 15105) -
Series.explode()现在支持 PyArrow 支持的列表类型(GH 53602) -
Series.str.join()现在支持ArrowDtype(pa.string())(GH 53646) -
在
Categorical.from_codes()中添加了validate参数(GH 50975) -
添加了
ExtensionArray.interpolate(),可供Series.interpolate()和DataFrame.interpolate()使用(GH 53659) -
在
DataFrame.to_excel()中添加了engine_kwargs参数(GH 53220) -
为
DatetimeTZDtype实现了api.interchange.from_dataframe()(GH 54239) -
在
DatetimeTZDtype上实现了__from_arrow__(GH 52201) -
实现了
__pandas_priority__,允许自定义类型优先于DataFrame、Series、Index或ExtensionArray进行算术操作,请参阅开发者指南(GH 48347") -
在使用
DataFrame.merge()时,当有不兼容的列时改进了错误消息(GH 51861) -
在通过
DataFrame.isetitem()设置具有错误列数的DataFrame时改进了错误消息(GH 51701) -
在使用
DataFrame.to_json()时改进了错误处理,当index和orient参数不兼容时(GH 52143) -
在创建包含空数据(0 行)、没有索引和不正确列数的 DataFrame 时改进了错误消息(GH 52084)
-
在提供无效的
index或offset参数给VariableOffsetWindowIndexer时改进了错误消息(GH 54379) -
让
DataFrame.to_feather()接受非默认Index和非字符串列名 (GH 51787) -
向
Series.apply()和DataFrame.apply()添加了一个新参数by_row。当设置为False时,提供的可调用对象将始终作用于整个 Series 或 DataFrame (GH 53400, GH 53601). -
DataFrame.shift()和Series.shift()现在允许通过提供周期列表进行多周期移位 (GH 44424) -
通过
numba进行分组聚合(例如DataFrameGroupBy.sum())现在可以保留输入的数据类型,而不是强制转换为float64(GH 44952) -
当
DataFrameGroupBy.agg()失败时,改进了错误消息 (GH 52930) -
许多读取/写入函数,如
DataFrame.to_pickle()和read_csv(),支持将压缩参数转发给lzma.LZMAFile(GH 52979) -
Reductions
Series.argmax(),Series.argmin(),Series.idxmax(),Series.idxmin(),Index.argmax(),Index.argmin(),DataFrame.idxmax(),DataFrame.idxmin()现在支持对象数据类型 (GH 4279, GH 18021, GH 40685, GH 43697) -
DataFrame.to_parquet()和read_parquet()现在分别会写入和读取attrs(GH 54346) -
Index.all()和Index.any()在浮点数据类型和 timedelta64 数据类型上不再引发TypeError,与Series.all()和Series.any()的行为一致 (GH 54566) -
Series.cummax(),Series.cummin()和Series.cumprod()现在支持 pyarrow 数据类型,要求 pyarrow 版本为 13.0 及以上 (GH 52085) -
增加了对 DataFrame Consortium Standard 的支持 (GH 54383)
-
DataFrameGroupBy.quantile()和SeriesGroupBy.quantile()的性能改进 (GH 51722) -
PyArrow 支持的整数 dtype 现在支持按位操作 (GH 54495)
不兼容的后向 API 更改
增加 Python 的最低版本
pandas 2.1.0 支持 Python 3.9 及更高版本。
增加了依赖项的最低版本
一些依赖项的最低支持版本已更新。如果已安装,现在我们需要:
| 包 | 最低版本 | 所需 | 更改 |
|---|---|---|---|
| numpy | 1.22.4 | X | X |
| mypy (dev) | 1.4.1 | X | |
| beautifulsoup4 | 4.11.1 | X | |
| bottleneck | 1.3.4 | X | |
| dataframe-api-compat | 0.1.7 | X | |
| fastparquet | 0.8.1 | X | |
| fsspec | 2022.05.0 | X | |
| 假设 | 6.46.1 | X | |
| gcsfs | 2022.05.0 | X | |
| jinja2 | 3.1.2 | X | |
| lxml | 4.8.0 | X | |
| numba | 0.55.2 | X | |
| numexpr | 2.8.0 | X | |
| openpyxl | 3.0.10 | X | |
| pandas-gbq | 0.17.5 | X | |
| psycopg2 | 2.9.3 | X | |
| pyreadstat | 1.1.5 | X | |
| pyqt5 | 5.15.6 | X | |
| pytables | 3.7.0 | X | |
| pytest | 7.3.2 | X | |
| python-snappy | 0.6.1 | X | |
| pyxlsb | 1.0.9 | X | |
| s3fs | 2022.05.0 | X | |
| scipy | 1.8.1 | X | |
| sqlalchemy | 1.4.36 | X | |
| tabulate | 0.8.10 | X | |
| xarray | 2022.03.0 | X | |
| xlsxwriter | 3.0.3 | X | |
| zstandard | 0.17.0 | X |
对于 可选库,一般建议使用最新版本。
有关更多信息,请参见 Dependencies 和 Optional dependencies。
其他 API 更改
arrays.PandasArray已重命名为NumpyExtensionArray,附带的 dtype 名称从PandasDtype更改为NumpyEADtype;导入PandasArray仍然有效,直到下一个主要版本 (GH 53694) ### 增加 Python 的最低版本
pandas 2.1.0 支持 Python 3.9 及更高版本。
增加了依赖项的最低版本
一些依赖项的最低支持版本已更新。如果已安装,现在我们需要:
| 包 | 最低版本 | 所需 | 更改 |
|---|---|---|---|
| numpy | 1.22.4 | X | X |
| mypy (dev) | 1.4.1 | X | |
| beautifulsoup4 | 4.11.1 | X | |
| bottleneck | 1.3.4 | X | |
| dataframe-api-compat | 0.1.7 | X | |
| fastparquet | 0.8.1 | X | |
| fsspec | 2022.05.0 | X | |
| hypothesis | 6.46.1 | X | |
| gcsfs | 2022.05.0 | X | |
| jinja2 | 3.1.2 | X | |
| lxml | 4.8.0 | X | |
| numba | 0.55.2 | X | |
| numexpr | 2.8.0 | X | |
| openpyxl | 3.0.10 | X | |
| pandas-gbq | 0.17.5 | X | |
| psycopg2 | 2.9.3 | X | |
| pyreadstat | 1.1.5 | X | |
| pyqt5 | 5.15.6 | X | |
| pytables | 3.7.0 | X | |
| pytest | 7.3.2 | X | |
| python-snappy | 0.6.1 | X | |
| pyxlsb | 1.0.9 | X | |
| s3fs | 2022.05.0 | X | |
| scipy | 1.8.1 | X | |
| sqlalchemy | 1.4.36 | X | |
| tabulate | 0.8.10 | X | |
| xarray | 2022.03.0 | X | |
| xlsxwriter | 3.0.3 | X | |
| zstandard | 0.17.0 | X |
对于可选库,一般建议使用最新版本。
有关更多信息,请参阅 Dependencies 和 Optional dependencies。
其他 API 更改
arrays.PandasArray已更名为NumpyExtensionArray,附加的数据类型名称从PandasDtype更改为NumpyEADtype;导入PandasArray仍然有效,直到下一个主要版本(GH 53694)
弃用
弃用了类似于 setitem 的 Series 操作中的静默转换
PDEP-6: pandas.pydata.org/pdeps/0006-ban-upcasting.html
对 Series(或 DataFrame 列)进行类似于 setitem 的操作,静默转换数据类型已被弃用并显示警告。受影响操作的示例包括:
-
ser.fillna('foo', inplace=True) -
ser.where(ser.isna(), 'foo', inplace=True) -
ser.iloc[indexer] = 'foo' -
ser.loc[indexer] = 'foo' -
df.iloc[indexer, 0] = 'foo' -
df.loc[indexer, 'a'] = 'foo' -
ser[indexer] = 'foo'
ser 是一个Series,df 是一个DataFrame,而indexer可以是一个切片、掩码、单个值、值列表或数组,或任何其他允许的索引器。
在将来的版本中,这些操作将引发错误,您应该首先将其转换为一个公共数据类型。
先前的行为:
In [1]: ser = pd.Series([1, 2, 3])
In [2]: ser
Out[2]:
0 1
1 2
2 3
dtype: int64
In [3]: ser[0] = 'not an int64'
In [4]: ser
Out[4]:
0 not an int64
1 2
2 3
dtype: object
新行为:
In [1]: ser = pd.Series([1, 2, 3])
In [2]: ser
Out[2]:
0 1
1 2
2 3
dtype: int64
In [3]: ser[0] = 'not an int64'
FutureWarning:
Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas.
Value 'not an int64' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.
In [4]: ser
Out[4]:
0 not an int64
1 2
2 3
dtype: object
为了保持当前行为,在上述情况下,您可以首先将ser转换为object数据类型:
In [21]: ser = pd.Series([1, 2, 3])
In [22]: ser = ser.astype('object')
In [23]: ser[0] = 'not an int64'
In [24]: ser
Out[24]:
0 not an int64
1 2
2 3
dtype: object
根据用例,将转换为不同的数据类型可能更合适。例如,在以下情况下,我们转换为float64:
In [25]: ser = pd.Series([1, 2, 3])
In [26]: ser = ser.astype('float64')
In [27]: ser[0] = 1.1
In [28]: ser
Out[28]:
0 1.1
1 2.0
2 3.0
dtype: float64
欲了解更多,请参阅pandas.pydata.org/pdeps/0006-ban-upcasting.html。
弃用了解析带有混合时区的日期时间
解析带有混合时区的日期时间已被弃用,并在用户未传递utc=True给to_datetime()时显示警告(GH 50887)
先前的行为:
In [7]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"]
In [8]: pd.to_datetime(data, utc=False)
Out[8]:
Index([2020-01-01 00:00:00+06:00, 2020-01-01 00:00:00+01:00], dtype='object')
新行为:
In [9]: pd.to_datetime(data, utc=False)
FutureWarning:
In a future version of pandas, parsing datetimes with mixed time zones will raise
a warning unless `utc=True`. Please specify `utc=True` to opt in to the new behaviour
and silence this warning. To create a `Series` with mixed offsets and `object` dtype,
please use `apply` and `datetime.datetime.strptime`.
Index([2020-01-01 00:00:00+06:00, 2020-01-01 00:00:00+01:00], dtype='object')
为了消除此警告并避免在未来版本的 pandas 中出现错误,请指定utc=True:
In [29]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"]
In [30]: pd.to_datetime(data, utc=True)
Out[30]: DatetimeIndex(['2019-12-31 18:00:00+00:00', '2019-12-31 23:00:00+00:00'], dtype='datetime64[ns, UTC]', freq=None)
要创建一个具有混合偏移和object dtype 的Series,请使用apply和datetime.datetime.strptime:
In [31]: import datetime as dt
In [32]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"]
In [33]: pd.Series(data).apply(lambda x: dt.datetime.strptime(x, '%Y-%m-%d %H:%M:%S%z'))
Out[33]:
0 2020-01-01 00:00:00+06:00
1 2020-01-01 00:00:00+01:00
dtype: object
其他弃用
-
弃用
DataFrameGroupBy.dtypes,请在底层对象上检查dtypes而不是dtypes(GH 51045) -
弃用
DataFrame._data和Series._data,请改用公共 API(GH 33333) -
当要连接的任何对象的长度为 0 时,弃用
concat()行为;在过去,当确定结果 dtype 时,空对象的 dtypes 被忽略,但在将来的版本中将不再忽略(GH 39122) -
弃用
Categorical.to_list(),请改用obj.tolist()(GH 51254) -
弃用带有 datetime64 或
PeriodDtype值的DataFrameGroupBy.all()和DataFrameGroupBy.any(),匹配Series和DataFrame的弃用(GH 34479) -
弃用
DataFrame.ewm()、DataFrame.rolling()、DataFrame.expanding()中的axis=1,在调用方法之前转置(GH 51778) -
弃用
DataFrame.groupby()和Grouper构造函数中的axis=1,请改用frame.T.groupby(...)(GH 51203) -
在
Series.align()和DataFrame.align()中弃用了broadcast_axis关键字,在调用align之前需使用left = DataFrame({col: left for col in right.columns}, index=right.index)进行类型转换 (GH 51856) -
在
Index.fillna()中弃用了downcast关键字 (GH 53956) -
在
DataFrame.pct_change()、Series.pct_change()、DataFrameGroupBy.pct_change()和SeriesGroupBy.pct_change()中弃用了fill_method和limit关键字,需要在调用pct_change之前显式调用例如DataFrame.ffill()或DataFrame.bfill()(GH 53491) -
在
DataFrame.align()和Series.align()中弃用了method、limit和fill_axis关键字,在对齐结果上显式调用DataFrame.fillna()或Series.fillna()(GH 51856) -
在
Rolling.quantile()和Expanding.quantile()中弃用了quantile关键字,改为q(GH 52550) -
Deprecated accepting slices in
DataFrame.take(), callobj[slicer]or pass a sequence of integers instead (GH 51539) -
Deprecated behavior of
DataFrame.idxmax(),DataFrame.idxmin(),Series.idxmax(),Series.idxmin()in with all-NA entries or any-NA andskipna=False; in a future version these will raiseValueError(GH 51276) -
Deprecated explicit support for subclassing
Index(GH 45289) -
Deprecated making functions given to
Series.agg()attempt to operate on each element in theSeriesand only operate on the wholeSeriesif the elementwise operations failed. In the future, functions given toSeries.agg()will always operate on the wholeSeriesonly. To keep the current behavior, useSeries.transform()instead (GH 53325) -
Deprecated making the functions in a list of functions given to
DataFrame.agg()attempt to operate on each element in theDataFrameand only operate on the columns of theDataFrameif the elementwise operations failed. To keep the current behavior, useDataFrame.transform()instead (GH 53325) -
弃用了将
DataFrame传递给DataFrame.from_records()方法,而应使用DataFrame.set_index()或DataFrame.drop()方法(GH 51353)。 -
在将字符串解析为日期时间时,静默弃用了未识别的时区(GH 18702)。
-
在
DataFrame.ewm()、Series.ewm()、DataFrame.rolling()、Series.rolling()、DataFrame.expanding()、Series.expanding()方法中弃用了axis关键字(GH 51778)。 -
在
DataFrame.resample()、Series.resample()方法中弃用了axis关键字(GH 51778)。 -
在
Series.interpolate()、DataFrame.interpolate()、Series.fillna()、DataFrame.fillna()、Series.ffill()、DataFrame.ffill()、Series.bfill()、DataFrame.bfill()方法中弃用了downcast关键字(GH 40988)。 -
弃用了在
concat()中len(keys) != len(objs)的行为,在未来的版本中,这将引发而不是截断为两个序列中较短的一个(GH 43485) -
在存在 NA 值时弃用了
Series.argsort()的行为;在未来的版本中,这些值将被放置在末尾而不是给出 -1(GH 54219) -
弃用了
DataFrame.groupby()和Series.groupby()中observed=False的默认值;这将在未来的版本中默认为True(GH 43999) -
在
SeriesGroupBy.aggregate()聚合中弃用了将group.name锁定到每个组的行为;如果您的操作需要使用 groupby 键,请遍历 groupby 对象而不是每个组(GH 41090) -
在
DataFrameGroupBy.idxmax()、DataFrameGroupBy.idxmin()、DataFrameGroupBy.fillna()、DataFrameGroupBy.take()、DataFrameGroupBy.skew()、DataFrameGroupBy.rank()、DataFrameGroupBy.cumprod()、DataFrameGroupBy.cumsum()、DataFrameGroupBy.cummax()、DataFrameGroupBy.cummin()、DataFrameGroupBy.pct_change()、DataFrameGroupBy.diff()、DataFrameGroupBy.shift()和DataFrameGroupBy.corrwith()中弃用了axis关键字;对于axis=1,操作的是底层的DataFrame而不是分组数据(GH 50405,GH 51046) -
废弃了带有
as_index=False的DataFrameGroupBy,当它们不是 DataFrame 的列时,不包括分组在结果中(GH 49519) -
废弃了
is_categorical_dtype(),请使用isinstance(obj.dtype, pd.CategoricalDtype)代替(GH 52527) -
废弃了
is_datetime64tz_dtype(),请检查isinstance(dtype, pd.DatetimeTZDtype)代替(GH 52607) -
废弃了
is_int64_dtype(),请检查dtype == np.dtype(np.int64)代替(GH 52564) -
废弃了
is_interval_dtype(),请检查isinstance(dtype, pd.IntervalDtype)代替(GH 52607) -
废弃了
is_period_dtype(),请检查isinstance(dtype, pd.PeriodDtype)代替(GH 52642) -
废弃了
is_sparse(),请检查isinstance(dtype, pd.SparseDtype)代替(GH 52642) -
废弃了
Styler.applymap_index()。请使用新的Styler.map_index()方法代替(GH 52708) -
废弃了
Styler.applymap()。请使用新的Styler.map()方法代替(GH 52708) -
废弃了
DataFrame.applymap()。请使用新的DataFrame.map()方法代替(GH 52353) -
废弃了
DataFrame.swapaxes()和Series.swapaxes(),请使用DataFrame.transpose()或Series.transpose()代替(GH 51946) -
在
PeriodArray构造函数中废弃了freq参数,请传递dtype代替(GH 52462) -
在
take()中不再允许使用非标准输入,传入numpy.ndarray、ExtensionArray、Index或Series(GH 52981) -
不再允许在
isin()、value_counts()、unique()、factorize()中使用非标准序列,在调用之前转换为numpy.ndarray、Index、ExtensionArray或Series(GH 52986) -
使用
axis=None的DataFrame缩减操作sum、prod、std、var、sem的行为将被弃用,在未来版本中,这将在两个轴上操作,返回一个标量,而不是像axis=0那样操作;请注意,这也会影响 numpy 函数,例如np.sum(df)([GH 21597](https://github.com/pandas-dev/pandas/issues/21597) -
当
DataFrame的列全部为 NA 时,concat()的行为将被弃用,在未来版本中,当确定结果 dtype 时,这些列将不会被丢弃(GH 40893) -
未来版本中,
Series.dt.to_pydatetime()的行为将被弃用,将返回包含 pythondatetime对象而不是日期时间ndarray的Series;这与其他Series.dt属性的行为相匹配(GH 20306) -
在 pandas 对象和无 dtype 序列(例如
list、tuple)之间的逻辑操作(|,&,^)的行为将被弃用,操作之前请将序列包装在Series或 NumPy 数组中(GH 51521) -
在
Series.apply()中弃用了参数convert_type(GH 52140)。 -
弃用了将字典传递给
SeriesGroupBy.agg()的方法;请传递一个聚合列表(GH 50684)。 -
在
Categorical构造函数中弃用了fastpath关键字,请改用Categorical.from_codes()(GH 20110)。 -
方法
is_bool_dtype()返回对象类型为布尔值的Index时的行为已弃用,返回值为True(GH 52680)。 -
弃用了方法
Series.bool()和DataFrame.bool()(GH 51749)。 -
在
DatetimeIndex构造函数中弃用了未使用的closed和normalize关键字(GH 52628)。 -
在
TimedeltaIndex构造函数中弃用了未使用的closed关键字(GH 52628)。 -
两个具有不同索引的非布尔值
Series之间的逻辑运算已弃用,结果始终强制转换为布尔值类型。在将来的版本中,这将保持输入的返回类型(GH 52500, GH 52538)。 -
弃用了带有
BDay频率的Period和PeriodDtype,请改用带有BDay频率的DatetimeIndex(GH 53446)。 -
弃用了
value_counts(),请改用pd.Series(obj).value_counts()(GH 47862)。 -
废弃了
Series.first()和DataFrame.first();请使用.loc创建掩码和过滤器代替(GH 45908) -
废弃了
Series.interpolate()和DataFrame.interpolate()用于对象数据类型(GH 53631) -
废弃了
Series.last()和DataFrame.last();请使用.loc创建掩码和过滤器代替(GH 53692) -
废弃了在
SparseDtype中允许任意的fill_value,在将来的版本中,fill_value将需要与dtype.subtype兼容,即可以由该子类型保存的标量或整数或布尔子类型的NaN(GH 23124) -
废弃了在
DataFrameGroupBy.quantile()和SeriesGroupBy.quantile()中允许布尔数据类型,与Series.quantile()和DataFrame.quantile()的行为一致(GH 51424) -
废弃了
testing.assert_series_equal()和testing.assert_frame_equal()考虑 NA 值(例如NaN与None等效)的行为(GH 52081) -
废弃了将字节输入到
read_excel()。要读取文件路径,请使用字符串或类似路径的对象(GH 53767) -
弃用从标量数据构造
SparseArray的方法,请传递一个序列代替(GH 53039) -
在
DataFrame.replace()和Series.replace()中,当value未指定时,弃用回退到填充的方法,使用非字典样式的to_replace替代(GH 33302) -
弃用在
read_json()中直接输入 JSON 文本字符串的方法。请改为将文字 JSON 字符串输入包装在io.StringIO中(GH 53409) -
弃用在
read_xml()中直接输入文字字符串的方法。请改为使用io.StringIO/io.BytesIO包装文字字符串/字节的输入(GH 53767) -
弃用在
read_html()中直接输入文字字符串/字节的方法。请改为使用io.StringIO/io.BytesIO包装文字字符串/字节的输入(GH 53767) -
弃用选项
mode.use_inf_as_na,请在之前将inf条目转换为NaN(GH 51684) -
在
DataFrameGroupBy.get_group()中,弃用参数obj(GH 53545) -
弃用在
Series的Series.__getitem__()和Series.__setitem__()上进行位置索引。在将来版本中,ser[item]将始终将item解释为标签,而不是位置(GH 50617) -
在
.agg、.apply和.transform中弃用替换内置和 NumPy 函数的方法;改用相应的字符串别名(例如"sum"代替sum或np.sum)替代(GH 53425) -
弃用在
to_timedelta()中使用字符串T、t、L和l表示单位的方法(GH 52536) -
弃用
.ExtensionArray.fillna中的 “method” 和 “limit” 关键字,请改为实现_pad_or_backfill(GH 53621) -
弃用了
DataFrame.replace()和Series.replace()方法中的method和limit关键词(GH 33302) -
弃用了
Series.fillna()、DataFrame.fillna()、SeriesGroupBy.fillna()、DataFrameGroupBy.fillna()和Resampler.fillna()方法中的method和limit关键词,改用obj.bfill()或obj.ffill()替代(GH 53394) -
弃用了在浮点类型索引对象上使用整数切片的
Series.__getitem__()、Series.__setitem__()、DataFrame.__getitem__()、DataFrame.__setitem__()的行为,在未来的版本中,这将被视为位置索引(GH 49612) -
弃用了在
pandas.array()中使用不支持的 datetime64 和 timedelta64 分辨率的值。支持的分辨率有:"s"、"ms"、"us"、"ns"(GH 53058) -
弃用了
Series.interpolate()和DataFrame.interpolate()中值为"pad"、"ffill"、"bfill"、"backfill"的选项,改用obj.ffill()或obj.bfill()替代(GH 53581) -
弃用了
Index.argmax()、Index.argmin()、Series.argmax()、Series.argmin()在全为 NA 且skipna=True或任何 NA 且skipna=False时��回-1 的行为;在将来的版本中,这将引发ValueError(GH 33941, GH 33942) -
在
DataFrame.to_sql()中不再允许非关键字参数,除了name和con(GH 54229)。 -
弃用了在同时传递
freq和fill_value给DataFrame.shift()、Series.shift()和DataFrameGroupBy.shift()时静默忽略fill_value的行为;在将来的版本中,这将引发ValueError(GH 53832)
弃用了类似设置项的 Series 操作中的静默提升 dtype
PDEP-6: pandas.pydata.org/pdeps/0006-ban-upcasting.html
对 Series(或 DataFrame 列)进行类似设置项的操作,会静默地提升 dtype,已被弃用并显示警告。受影响操作的示例有:
-
ser.fillna('foo', inplace=True) -
ser.where(ser.isna(), 'foo', inplace=True) -
ser.iloc[indexer] = 'foo' -
ser.loc[indexer] = 'foo' -
df.iloc[indexer, 0] = 'foo' -
df.loc[indexer, 'a'] = 'foo' -
ser[indexer] = 'foo'
其中ser是一个Series,df是一个DataFrame,而indexer可以是切片、掩码、单个值、值列表或数组,或任何其他允许的索引器。
在将来的版本中,这些将引发错误���您应该先转换为一个公共 dtype。
先前行为:
In [1]: ser = pd.Series([1, 2, 3])
In [2]: ser
Out[2]:
0 1
1 2
2 3
dtype: int64
In [3]: ser[0] = 'not an int64'
In [4]: ser
Out[4]:
0 not an int64
1 2
2 3
dtype: object
新行为:
In [1]: ser = pd.Series([1, 2, 3])
In [2]: ser
Out[2]:
0 1
1 2
2 3
dtype: int64
In [3]: ser[0] = 'not an int64'
FutureWarning:
Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas.
Value 'not an int64' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.
In [4]: ser
Out[4]:
0 not an int64
1 2
2 3
dtype: object
为保留当前行为,在上述情况下,您可以先将ser转换为object类型:
In [21]: ser = pd.Series([1, 2, 3])
In [22]: ser = ser.astype('object')
In [23]: ser[0] = 'not an int64'
In [24]: ser
Out[24]:
0 not an int64
1 2
2 3
dtype: object
根据用例,可能更适合转换为不同的 dtype。例如,在以下情况下,我们转换为float64:
In [25]: ser = pd.Series([1, 2, 3])
In [26]: ser = ser.astype('float64')
In [27]: ser[0] = 1.1
In [28]: ser
Out[28]:
0 1.1
1 2.0
2 3.0
dtype: float64
欲了解更多信息,请参阅pandas.pydata.org/pdeps/0006-ban-upcasting.html。
弃用了解析混合时区的日期时间
弃用了解析混合时区的日期时间,除非用户将utc=True传递给to_datetime() (GH 50887)
之前的行为:
In [7]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"]
In [8]: pd.to_datetime(data, utc=False)
Out[8]:
Index([2020-01-01 00:00:00+06:00, 2020-01-01 00:00:00+01:00], dtype='object')
新行为:
In [9]: pd.to_datetime(data, utc=False)
FutureWarning:
In a future version of pandas, parsing datetimes with mixed time zones will raise
a warning unless `utc=True`. Please specify `utc=True` to opt in to the new behaviour
and silence this warning. To create a `Series` with mixed offsets and `object` dtype,
please use `apply` and `datetime.datetime.strptime`.
Index([2020-01-01 00:00:00+06:00, 2020-01-01 00:00:00+01:00], dtype='object')
为了消除此警告并在将来版本的 pandas 中避免错误,请指定utc=True:
In [29]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"]
In [30]: pd.to_datetime(data, utc=True)
Out[30]: DatetimeIndex(['2019-12-31 18:00:00+00:00', '2019-12-31 23:00:00+00:00'], dtype='datetime64[ns, UTC]', freq=None)
要创建一个具有混合偏移和object dtype 的Series,请使用apply和datetime.datetime.strptime:
In [31]: import datetime as dt
In [32]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"]
In [33]: pd.Series(data).apply(lambda x: dt.datetime.strptime(x, '%Y-%m-%d %H:%M:%S%z'))
Out[33]:
0 2020-01-01 00:00:00+06:00
1 2020-01-01 00:00:00+01:00
dtype: object
其他弃用
-
弃用了
DataFrameGroupBy.dtypes,请检查底层对象上的dtypes代替 (GH 51045) -
弃用了
DataFrame._data和Series._data,请改用公共 API (GH 33333)。 -
当要连接的任何对象的长度为 0 时,弃用了
concat()的行为;在过去,当确定结果 dtype 时,空对象的 dtype 会被忽略,在将来的版本中,它们将不再被忽略 (GH 39122) -
弃用了
Categorical.to_list(),请使用obj.tolist()代替 (GH 51254) -
弃用了带有 datetime64 或
PeriodDtype值的DataFrameGroupBy.all()和DataFrameGroupBy.any(),与Series和DataFrame弃用一致 (GH 34479) -
弃用了在
DataFrame.ewm()、DataFrame.rolling()、DataFrame.expanding()中使用axis=1,请在调用方法之前转置 (GH 51778) -
弃用了在
DataFrame.groupby()和Grouper构造函数中使用axis=1,请改用frame.T.groupby(...)(GH 51203) -
在
Series.align()和DataFrame.align()中弃用了broadcast_axis关键字,在调用align之前使用left = DataFrame({col: left for col in right.columns}, index=right.index)进行向上转换(GH 51856) -
在
Index.fillna()中弃用了downcast关键字(GH 53956) -
在
DataFrame.pct_change()、Series.pct_change()、DataFrameGroupBy.pct_change()和SeriesGroupBy.pct_change()中弃用了fill_method和limit关键字,显式调用例如DataFrame.ffill()或DataFrame.bfill()在调用pct_change之前代替(GH 53491) -
在
DataFrame.align()和Series.align()中弃用了method、limit和fill_axis关键字,显式在对齐结果上调用DataFrame.fillna()或Series.fillna()代替(GH 51856) -
在
Rolling.quantile()和Expanding.quantile()中弃用了quantile关键字,改名为q(GH 52550) -
在
DataFrame.take()中弃用了接受切片的功能,请改为调用obj[slicer]或传递整数序列代替 (GH 51539) -
弃用了在所有-NA 条目或任何-NA 和
skipna=False情况下DataFrame.idxmax()、DataFrame.idxmin()、Series.idxmax()、Series.idxmin()的行为; 在将来的版本中,它们将引发ValueError(GH 51276) -
弃用了对子类化
Index的显式支持 (GH 45289) -
弃用了使给定给
Series.agg()的函数尝试对Series的每个元素进行操作,并仅在元素级操作失败时才对整个Series进行操作。在将来,给定给Series.agg()的函数将始终仅对整个Series进行操作。要保持当前行为,请改用Series.transform()(GH 53325) -
弃用了使给定给
DataFrame.agg()的函数列表中的函数尝试对DataFrame的每个元素进行操作,并仅在元素级操作失败时才对DataFrame的列进行操作。要保持当前行为,请改用DataFrame.transform()(GH 53325) -
在
DataFrame.from_records()中弃用了传递DataFrame,请改用DataFrame.set_index()或DataFrame.drop()代替(GH 51353) -
在将字符串解析为日期时间时,默默弃用了无法识别的时区(GH 18702)
-
在
DataFrame.ewm()、Series.ewm()、DataFrame.rolling()、Series.rolling()、DataFrame.expanding()、Series.expanding()中弃用了axis关键字(GH 51778) -
在
DataFrame.resample()、Series.resample()中弃用了axis关键字(GH 51778) -
在
Series.interpolate()、DataFrame.interpolate()、Series.fillna()、DataFrame.fillna()、Series.ffill()、DataFrame.ffill()、Series.bfill()、DataFrame.bfill()中弃用了downcast关键字(GH 40988) -
在未来的版本中,弃用了
concat()对len(keys) != len(objs)的行为,将会引发异常而不是截断为两个序列中较短的一个(GH 43485) -
在存在 NA 值时,弃用了
Series.argsort()的行为;在未来的版本中,这些值将在最后排序,而不是返回-1(GH 54219) -
在
DataFrame.groupby()和Series.groupby()中弃用了observed=False的默认值;这在未来的版本中将默认为True(GH 43999) -
在
SeriesGroupBy.aggregate()聚合中,停用了将group.name固定到每个组的操作;如果您的操作需要使用 groupby 键,请遍历 groupby 对象而不是利用group.name(GH 41090) -
在
DataFrameGroupBy.idxmax(),DataFrameGroupBy.idxmin(),DataFrameGroupBy.fillna(),DataFrameGroupBy.take(),DataFrameGroupBy.skew(),DataFrameGroupBy.rank(),DataFrameGroupBy.cumprod(),DataFrameGroupBy.cumsum(),DataFrameGroupBy.cummax(),DataFrameGroupBy.cummin(),DataFrameGroupBy.pct_change(),DataFrameGroupBy.diff(),DataFrameGroupBy.shift(),和DataFrameGroupBy.corrwith()中弃用了axis关键字;对于axis=1,操作的是底层的DataFrame而不是(GH 50405,GH 51046)。 -
使用
as_index=False的DataFrameGroupBy在结果中不包含分组,当它们不是 DataFrame 的列时已被废弃(GH 49519) -
废弃的
is_categorical_dtype(),请使用isinstance(obj.dtype, pd.CategoricalDtype)代替(GH 52527) -
废弃的
is_datetime64tz_dtype(),请使用isinstance(dtype, pd.DatetimeTZDtype)代替(GH 52607) -
废弃的
is_int64_dtype(),请使用dtype == np.dtype(np.int64)代替(GH 52564) -
废弃的
is_interval_dtype(),请使用isinstance(dtype, pd.IntervalDtype)代替(GH 52607) -
废弃的
is_period_dtype(),请使用isinstance(dtype, pd.PeriodDtype)代替(GH 52642) -
废弃的
is_sparse(),请使用isinstance(dtype, pd.SparseDtype)代替(GH 52642) -
废弃的
Styler.applymap_index()。请使用新的Styler.map_index()方法代替(GH 52708) -
废弃的
Styler.applymap()。请使用新的Styler.map()方法代替(GH 52708) -
废弃的
DataFrame.applymap()。请使用新的DataFrame.map()方法代替(GH 52353) -
废弃的
DataFrame.swapaxes()和Series.swapaxes(),请使用DataFrame.transpose()或Series.transpose()代替(GH 51946) -
PeriodArray构造函数中的freq参数已废弃,改用dtype代替(GH 52462) -
弃用在
take()中允许非标准输入的行为,请传递一个numpy.ndarray、ExtensionArray、Index或Series(GH 52981) -
弃用在
isin()、value_counts()、unique()、factorize()中允许非标准序列的行为,在调用之前,请将其转换为numpy.ndarray、Index、ExtensionArray或Series(GH 52986) -
弃用在
DataFrame缩减操作sum、prod、std、var、sem中使用axis=None的行为,将来版本中,这将在两个轴上操作,返回标量而不是像axis=0一样的行为;注意,这也会影响到 numpy 函数,例如np.sum(df)(GH 21597) -
当
DataFrame的列全部为 NA 时,弃用concat()的行为,将来版本中,这些列将不会在确定结果 dtype 时被丢弃(GH 40893) -
将来版本中,
Series.dt.to_pydatetime()的行为将被弃用,将返回包含 Pythondatetime对象而不是 datetime 数组的Series;这与其他Series.dt属性的行为一致(GH 20306) -
弃用在 pandas 对象和无 dtype 序列(例如
list、tuple)之间的逻辑操作 (|,&,^),在操作之前请将序列包装在一个Series或 NumPy 数组中(GH 51521) -
在
Series.apply()中弃用了参数convert_type(GH 52140) -
弃用了将字典传递给
SeriesGroupBy.agg();请传递一个聚合列表代替(GH 50684) -
在
Categorical构造函数中弃用了fastpath关键字,请改用Categorical.from_codes()(GH 20110) -
is_bool_dtype()方法的行为已被弃用,对于布尔对象的对象 dtypeIndex,将返回True(GH 52680) -
弃用了方法
Series.bool()和DataFrame.bool()(GH 51749) -
在
DatetimeIndex构造函数中弃用了未使用的closed和normalize关键字(GH 52628) -
在
TimedeltaIndex构造函数中弃用了未使用的closed关键字(GH 52628) -
弃用了两个非布尔
Series之间的逻辑操作,它们具有不同的索引,结果始终强制转换为布尔 dtype。在未来的版本中,这将保持输入的返回类型(GH 52500, GH 52538) -
Period和PeriodDtype已被弃用,带有BDay频率,请改用带有BDay频率的DatetimeIndex(GH 53446) -
弃用了
value_counts(),请改用pd.Series(obj).value_counts()(GH 47862) -
废弃了
Series.first()和DataFrame.first();改用创建掩码并使用.loc进行过滤(GH 45908) -
废弃了
Series.interpolate()和DataFrame.interpolate()用于对象 dtype(GH 53631) -
废弃了
Series.last()和DataFrame.last();改用创建掩码并使用.loc进行过滤(GH 53692) -
废弃了在
SparseDtype中允许任意fill_value,在将来的版本中,fill_value将需要与dtype.subtype兼容,要么是可以由该 subtype 保存的标量,要么是整数或布尔子类型的NaN(GH 23124) -
废弃了在
DataFrameGroupBy.quantile()和SeriesGroupBy.quantile()中允许布尔 dtype,与Series.quantile()和DataFrame.quantile()的行为一致(GH 51424) -
废弃了对
testing.assert_series_equal()和testing.assert_frame_equal()的行为,考虑 NA 类似值(例如NaNvsNone视为等价)(GH 52081) -
废弃了将字节输入到
read_excel()。要读取文件路径,请使用字符串或类似路径的对象(GH 53767) -
废弃使用标量数据构造
SparseArray,请传递一个序列代替(GH 53039) -
废弃在
DataFrame.replace()和Series.replace()中当value未指定时回退到填充的操作,使用非字典形式的to_replace(GH 33302) -
废弃对
read_json()的字面 json 输入。请将字面 json 字符串输入包装在io.StringIO中(GH 53409) -
废弃对
read_xml()的字面字符串输入。请改用io.StringIO/io.BytesIO包装字面字符串/字节输入(GH 53767) -
废弃对
read_html()的字面字符串/字节输入。请改用io.StringIO/io.BytesIO包装字面字符串/字节输入(GH 53767) -
废弃选项
mode.use_inf_as_na,在之前将 inf 条目转换为NaN(GH 51684) -
废弃
DataFrameGroupBy.get_group()中的参数obj(GH 53545) -
废弃在
Series上使用位置索引的Series.__getitem__()和Series.__setitem__(),在将来的版本中,ser[item]将始终将item解释为标签,而不是位置(GH 50617) -
废弃在
.agg、.apply和.transform中替换内置和 NumPy 函数;请使用相应的字符串别名(例如"sum"代替sum或np.sum)(GH 53425) -
废弃在
to_timedelta()中使用T、t、L和l表示单位的字符串(GH 52536) -
废弃在
.ExtensionArray.fillna中的 “method” 和 “limit” 关键字,改用_pad_or_backfill实现(GH 53621) -
废弃了
DataFrame.replace()和Series.replace()中的method和limit关键字(GH 33302) -
废弃了
Series.fillna()、DataFrame.fillna()、SeriesGroupBy.fillna()、DataFrameGroupBy.fillna()和Resampler.fillna()中的method和limit关键字,改用obj.bfill()或obj.ffill()代替(GH 53394) -
废弃了在具有浮点类型索引的对象上使用
Series.__getitem__()、Series.__setitem__()、DataFrame.__getitem__()、DataFrame.__setitem__()进行整数切片的行为,在将来的版本中,这将被视为位置索引(GH 49612) -
废弃了在
pandas.array()中使用不支持的 datetime64 和 timedelta64 分辨率。支持的分辨率有:"s"、"ms"、"us"、"ns"分辨率(GH 53058) -
废弃了
Series.interpolate()和DataFrame.interpolate()中的值"pad"、"ffill"、"bfill"、"backfill",请改用obj.ffill()或obj.bfill()代替(GH 53581) -
在将所有值为 NA 且
skipna=True或任何值为 NA 且skipna=False的情况下,不再返回 -1,而是引发ValueError,这涉及Index.argmax()、Index.argmin()、Series.argmax()和Series.argmin()的行为;在未来版本中将引发ValueError(GH 33941、GH 33942) -
不再允许在
DataFrame.to_sql()中使用非关键字参数,除了name和con(GH 54229) -
在未来版本中,当同时将
freq和fill_value传递给DataFrame.shift()、Series.shift()和DataFrameGroupBy.shift()时,不再默默忽略fill_value,而是引发ValueError(GH 53832)
性能改进
-
在使用同类
np.float64或np.float32数据类型的情况下,concat()的性能有所提高(GH 52685) -
对于不包含字符串的对象列,
factorize()的性能有所提高(GH 51921) -
在读取远程 URI 文件路径时,
read_orc()的性能有所提高(GH 51609) -
在使用
engine="pyarrow"读取远程文件时,read_parquet()和DataFrame.to_parquet()的性能有所提高(GH 51609) -
在使用
use_nullable_dtypes=True时,read_parquet()在字符串列上的性能有所提高(GH 47345) -
在
DataFrame.clip()和Series.clip()中的性能改进(GH 51472) -
在
DataFrame.filter()中给定items时的性能改进(GH 52941) -
在扩展数组数据类型的
DataFrame.first_valid_index()和DataFrame.last_valid_index()中的性能改进(GH 51549) -
在
cond由扩展数据类型支持时的DataFrame.where()性能改进(GH 51574) -
在
MultiIndex.set_levels()和MultiIndex.set_codes()中当verify_integrity=True时的性能改进(GH 51873) -
在
MultiIndex.sortlevel()中对ascending是列表时的性能改进(GH 51612) -
在
Series.combine_first()中的性能改进(GH 51777) -
在数组不包含空值时的
fillna()性能改进(GH 51635) -
在数组没有空值或全部为空值时的
isna()性能改进(GH 51630) -
在将字符串解析为
boolean[pyarrow]类型时的性能改进(GH 51730) -
在从其他索引切片的
Index中搜索时的性能改进(GH 51738) -
Period类的默认格式化器 (period_format) 现在显著地(~两倍)更快。这提高了str(Period),repr(Period)和Period.strftime(fmt=None)的性能,以及.PeriodArray.strftime(fmt=None),.PeriodIndex.strftime(fmt=None)和.PeriodIndex.format(fmt=None)。涉及默认date_format的PeriodArray或PeriodIndex的to_csv操作也显著加速了(GH 51459) -
访问
arrays.IntegerArrays.dtype和arrays.FloatingArray.dtype的性能改进(GH 52998) -
DataFrameGroupBy/SeriesGroupBy聚合(例如DataFrameGroupBy.sum())使用engine="numba"的性能改进(GH 53731) -
在带有扩展数据类型的
DataFrame的axis=1归纳中的性能改进(GH 54341) -
在带有扩展数据类型的
DataFrame的axis=None归纳中的性能改进(GH 54308) -
在索引/列值已排序时的
MultiIndex和多列操作(例如DataFrame.sort_values(),DataFrame.groupby(),Series.unstack())中的性能改进(GH 53806) -
在
Series归纳中的性能改进(GH 52341) -
在
concat()函数中当axis=1且对象具有不同索引时的性能改进(GH 52541) -
concat()当连接轴是MultiIndex时有性能改进(GH 53574)。 -
merge()在 PyArrow 支持的字符串上有性能改进(GH 54443)。 -
read_csv()使用engine="c"时有性能改进(GH 52632)。 -
ArrowExtensionArray.to_numpy()有性能改进(GH 52525)。 -
DataFrameGroupBy.groups()有性能改进(GH 53088)。 -
DataFrame.astype()在dtype是扩展类型时有性能改进(GH 54299)。 -
DataFrame.iloc()在输入为单个整数且 DataFrame 受扩展类型支持时有性能改进(GH 54508)。 -
DataFrame.isin()在扩展类型上有性能改进(GH 53514)。 -
DataFrame.loc()在选择行和列时有性能改进(GH 53014)。 -
DataFrame.transpose()在转置单个 PyArrow 类型的 DataFrame 时有性能改进(GH 54224)。 -
DataFrame.transpose()在转置单个掩码类型的 DataFrame 时有性能改进,例如Int64(GH 52836)。 -
Series.add()在 PyArrow 字符串和二进制类型时有性能改进(GH 53150)。 -
Series.corr()和Series.cov()中的性能改进,针对扩展的数据类型(GH 52502) -
Series.drop_duplicates()针对ArrowDtype的性能改进(GH 54667) -
在具有 PyArrow 数据类型的情况下,
Series.ffill()、Series.bfill()、DataFrame.ffill()、DataFrame.bfill()的性能改进(GH 53950) -
Series.str.get_dummies()中的性能改进,针对 PyArrow 支持的字符串(GH 53655) -
Series.str.get()在 PyArrow 支持的字符串中的性能改进(GH 53152) -
Series.str.split()在 PyArrow 支持的字符串中使用expand=True时的性能改进(GH 53585) -
当 dtype 为 NumPy 浮点数据类型且
na_value为np.nan时,Series.to_numpy()的性能改进(GH 52430) -
在从 PyArrow 时间戳或持续时间数据类型转换为 NumPy 时,
astype()的性能改进(GH 53326) -
各种
MultiIndex设置和索引操作的性能改进(GH 53955) -
在
arrays.IntegerArray和arrays.FloatingArray上执行各种重塑操作时的性能改进,避免进行不必要的验证(GH 53013) -
使用 PyArrow 时间戳和持续时间数据类型进行索引时的性能改进(GH 53368)
-
当将数组传递给
RangeIndex.take()、DataFrame.loc()或DataFrame.iloc()时,性能改进,并且 DataFrame 使用 RangeIndex 时(GH 53387)
Bug 修复
Categorical
-
在
CategoricalIndex.remove_categories()中的错误,有序类别将不会被维护(GH 53935). -
在具有只读空值掩码的可空数组中,使用
dtype="category"的Series.astype()中的错误(GH 53658) -
在
Series.map()中的错误,如果系列持有Categorical,则na_action参数的值不会被使用(GH 22527).
Datetimelike
-
DatetimeIndex.map()在na_action="ignore"下现在按预期工作(GH 51644) -
如果切片边界中的任一边界不在索引中,则
DatetimeIndex.slice_indexer()现在对非单调索引引发KeyError;此行为先前已被弃用,但处理不一致(GH 53983) -
在将
DateOffset对象乘以常数时,DateOffset中存在不一致行为的错误(GH 47953) -
在
freq为DateOffset且具有nanoseconds时的date_range()中的错误(GH 46877) -
在将包含 PyArrow 时间戳的
Series或DataFrame转换为 numpy 日期时间的to_datetime()中的错误(GH 52545) -
在
DatetimeArray.map()和DatetimeIndex.map()中存在错误,提供的可调用函数是数组级别操作而不是元素级别操作(GH 51977) -
在使用 PyArrow 支持的日期类型时,
DataFrame.to_sql()引发ValueError错误(GH 53854) -
在
Timestamp.date()、Timestamp.isocalendar()、Timestamp.timetuple()和Timestamp.toordinal()中,对于 Python 标准库的 datetime 模块不支持的输入,返回结果错误(GH 53668) -
在接近实现边界的值上使用
Timestamp.round()返回错误结果而不是引发OutOfBoundsDatetime错误(GH 51494) -
从日期时间标量构造
Series或DataFrame时,总是推断纳秒分辨率而不是从输入中推断(GH 52212) -
从不带日期的时间字符串构造
Timestamp存在错误,推断出错误的单位(GH 54097) -
使用
ts_input=pd.NA构造Timestamp时引发TypeError错误(GH 45481) -
解析带有工作日但没有日期的日期时间字符串,例如“2023 年 9 月星期四”,错误地引发
AttributeError而不是ValueError(GH 52659) -
当
dtype为时区感知的非纳秒分辨率日期时间时,Series的repr存在错误,引发OutOfBoundsDatetime错误(GH 54623)
时间差
-
TimedeltaIndex中的错误,除法或乘法导致.freq为“0 Days”而不是None(GH 51575) -
Timedelta中的错误,NumPy 的timedelta64对象未正确引发ValueError(GH 52806) -
to_timedelta()中的错误,将包含pyarrow.duration的Series或DataFrame转换为 NumPy 的timedelta64时出错(GH 54298) -
Timedelta.__hash__()中的错误,在某些大值的秒分辨率上引发OutOfBoundsTimedelta(GH 54037) -
Timedelta.round()中的错误,对接近实现边界的值返回不正确的结果而不是引发OutOfBoundsTimedelta(GH 51494) -
TimedeltaIndex.map()中的错误,使用na_action="ignore"时出错(GH 51644) -
arrays.TimedeltaArray.map()和TimedeltaIndex.map()中的错误,提供的可调用函数是数组级别操作而不是元素级别操作(GH 51977)
时区
-
infer_freq()中的错误,对于时区感知时间戳的Series引发TypeError(GH 52456) -
DatetimeTZDtype.base()中的错误,始终返回具有纳秒分辨率的 NumPy dtype(GH 52705)
数值
-
RangeIndex中的错误,在被减数为数值时,设置step不正确,而减数为RangeIndex(GH 53255) -
Series.corr()和Series.cov()中的错误,对于掩码 dtype 引发AttributeError(GH 51422) -
在所有零值的 NumPy 数据上调用
Series.kurt()和Series.skew()返回 Python 类型而不是 NumPy 类型的错误(GH 53482) -
Bug in
Series.mean(),DataFrame.mean()中包含可转换为数字的字符串(例如“2”)的对象数据类型返回不正确的数值结果;现在会引发TypeError(GH 36703, GH 44008) -
Bug in
DataFrame.corrwith()对于 PyArrow-backed 数据类型引发NotImplementedError的错误(GH 52314) -
Bug in
DataFrame.size()和Series.size()返回 64 位整数而不是 Python int 的错误(GH 52897) -
Bug in
DateFrame.dot()返回object数据类型而不是ArrowDtype数据的错误(GH 53979) -
Bug in
Series.any(),Series.all(),DataFrame.any(), 和DataFrame.all()中bool_only的默认值设置为None而不是False的错误;这个更改不应对用户产生影响(GH 53258) -
Bug in
Series.corr()和Series.cov()对于掩码数据类型引发AttributeError的错误(GH 51422) -
当包含可以转换为数字的字符串的 object-dtype 值(例如“2”)时,
Series.median()和DataFrame.median()中存在 Bug,返回不正确的数值结果;现在会引发TypeError(GH 34671) -
将 dtype 为
uint64的数据转换为int64时,Series.sum()中存在 Bug (GH 53401)
转换
-
如果 DataFrame 包含比浮点双精度表示法能表示的整数位数更多的整数,则
DataFrame.style.to_latex()和DataFrame.style.to_html()中存在 Bug (GH 52272) -
当给定
datetime64或timedelta64dtype 并且单位为“s”、“us”或“ms”时,array()中存在 Bug,返回NumpyExtensionArray而不是DatetimeArray或TimedeltaArray(GH 52859) -
当给定空列表且没有 dtype 时,
array()中存在 Bug,返回NumpyExtensionArray而不是FloatingArray(GH 54371) -
当
pyarrow.timestamp和pyarrow.duration类型的非纳秒单位时,ArrowDtype.numpy_dtype()中存在 Bug,返回纳秒单位 (GH 51800) -
当列的 dtype 是
np.record时,DataFrame.__repr__()不正确地引发TypeError(GH 48526) -
当设置
use_numba时,DataFrame.info()中存在 Bug,抛出ValueError(GH 51922) -
当
loc为np.int64时,DataFrame.insert()中存在 Bug,抛出TypeError(GH 53193) -
在存储和检索时,
HDFStore.select()会丢失大整数的精度(GH 54186)。 -
Series.astype()不支持object_的错误修复(GH 54251)。
字符串
区间
-
当
target为只读数组时,IntervalIndex.get_indexer()和IntervalIndex.get_indexer_nonunique()会引发错误(GH 53703)。 -
当删除时,
IntervalDtype中的对象可能被保持活动(GH 54184)。 -
当使用浮点数
step时,interval_range()会产生错误的区间(GH 54477)。
索引
-
修复了在将
DataFrame设置到重复列时DataFrame.__setitem__()丢失 dtype 的错误(GH 53143)。 -
在混合非数值类型和值不为
NaN的布尔掩码和DataFrame.putmask()时,DataFrame.__setitem__()存在错误引发TypeError(GH 53291)。 -
当将
nan作为唯一元素时,使用DataFrame.iloc()存在错误(GH 52234)。 -
当将
Series分配给预定义索引的objectdtypeSeries时,Series.loc()将Series转换为np.dnarray的错误(GH 48933)。
缺失
-
DataFrame.interpolate()中的错误,在method为"pad"、"ffill"、"bfill"或"backfill"时无法填充数据(GH 53898) -
DataFrame.interpolate()中的错误,在DataFrame为空时忽略inplace(GH 53199) -
Series.idxmin()、Series.idxmax()、DataFrame.idxmin()、DataFrame.idxmax()中的错误,在包含NaT的DatetimeIndex索引中,错误地返回NaN而不是NaT(GH 43587) -
Series.interpolate()和DataFrame.interpolate()中的错误,在无效的downcast关键字上未引发异常,该关键字只能是None或"infer"(GH 53103) -
Series.interpolate()和DataFrame.interpolate()中的错误,对复杂 dtype 填充NaN条目时出现错误(GH 53635)
MultiIndex
I/O
-
DataFrame.to_orc()现在在给定非默认Index时会引发ValueError(GH 51828) -
DataFrame.to_sql()现在在使用 SQLAlchemy 连接时,当参数 name 为空时会引发ValueError(GH 52675) -
json_normalize()存在一个 bug,无法解析元数据字段列表类型 (GH 37782) -
read_csv()存在一个 bug,在parse_dates设置为列表或字典时,使用engine="pyarrow"会报错 (GH 47961) -
read_csv()存在一个 bug,当指定dtype与index_col时,使用engine="pyarrow"报错 (GH 53229) -
read_hdf()存在一个 bug,在引发IndexError后未正确关闭存储 (GH 52781) -
read_html()存在一个 bug,样式元素会被读取到 DataFrame 中 (GH 52197) -
read_html()存在一个 bug,尾部文本和包含display:none样式的元素一同被移除 (GH 51629) -
read_sql_table()在读取视图时会引发异常 (GH 52969) -
read_sql()在读取具有相同列名的多个时区感知列时存在一个 bug (GH 44421) -
read_xml()存在一个 bug,会剥离字符串数据中的空白字符 (GH 53811) -
DataFrame.to_html()存在一个 bug,多级索引列情况下colspace被错误应用 (GH 53885) -
修复了
DataFrame.to_html()中对具有复杂 dtype 的空DataFrame进行转换引发ValueError的错误(GH 54167) -
修复了
DataFrame.to_json()中DateTimeArray/DateTimeIndex的非纳秒精度无法正确序列化的错误(GH 53686) -
修复了写入和读取空的 Stata dta 文件时丢失 dtype 信息的错误(GH 46240)
-
修复了
bz2被视为硬性要求的错误(GH 53857)
期间
-
修复了
PeriodDtype构造函数在未传递参数或传递None时未引发TypeError的错误(GH 27388) -
修复了
PeriodDtype构造函数在不同的DateOffsetfreq输入下错误地返回相同的normalize的错误(GH 24121) -
修复了
PeriodDtype构造函数在传递无效类型时引发ValueError而不是TypeError的错误(GH 51790) -
修复了
PeriodDtype中对象在删除时可能被保持活动的错误(GH 54184) -
修复了使用
engine="pyarrow"时read_csv()未将空字符串处理为 null 值的错误(GH 52087) -
修复了使用
engine="pyarrow"时read_csv()返回objectdtype 列而不是float64dtype 列的错误,对于所有值为空的列使用engine="pyarrow"(GH 52087) -
修复了
Period.now()不接受freq参数作为关键字参数的错误(GH 53369) -
修复了
PeriodIndex.map()中na_action="ignore"的错误(GH 51644) -
修复了
arrays.PeriodArray.map()和PeriodIndex.map()中提供的可调用函数是数组级别操作而不是元素级别操作的错误(GH 51977) -
错误允许使用
CustomBusinessDay频率构造Period或PeriodDtype的 Bug;请使用BusinessDay代替(GH 52534)。
绘图
-
当以
color=None调用时,Series.plot()存在 Bug (GH 51953)。 -
在以
c="b"调用时,DataFrame.plot.scatter()存在 UserWarning 的 Bug 已修复 (GH 53908)。
分组/重新采样/滚动
-
DataFrameGroupBy.idxmin()、SeriesGroupBy.idxmin()、DataFrameGroupBy.idxmax()和SeriesGroupBy.idxmax()在对空的 DataFrameGroupBy 或 SeriesGroupBy 使用时返回错误的数据类型(GH 51423)。 -
当传递
na_option="bottom"或na_option="top"时,在可空数据类型上调用DataFrame.groupby.rank()的 Bug (GH 54206)。 -
当在
TimedeltaIndex上重新采样时,DataFrame.resample()和Series.resample()错误允许非固定freq的 Bug (GH 51896)。 -
在重新采样空数据时,
DataFrame.resample()和Series.resample()会丢失时区(GH 53664)。 -
DataFrame.resample()和Series.resample()中的 Bug,在重采样时origin不起作用,当值超出轴范围时(GH 53662)。 -
在指定
min_periods=0时,加权滚动聚合中的 Bug(GH 51449)。 -
DataFrame.groupby()和Series.groupby()中的 Bug,当分组的Series或DataFrame的索引是DatetimeIndex、TimedeltaIndex或PeriodIndex时,而且groupby方法的第一个参数是函数时,该函数对整个索引而不是索引的每个元素进行操作(GH 51979)。 -
DataFrameGroupBy.agg()中的 Bug,当使用列表时不遵守as_index=False(GH 52849)。 -
DataFrameGroupBy.apply()中的 Bug,当输入的DataFrame在进行 groupby 后被子集化为DataFrame([['a']]而不是['a'])并且给定的可调用函数返回的Series的索引不完全相同时,会引发错误(GH 52444)。 -
DataFrameGroupBy.apply()中的 Bug,当选择多列并提供返回np.ndarray结果的函数时引发TypeError(GH 18930)。 -
DataFrameGroupBy.groups()和SeriesGroupBy.groups()中存在的错误,与另一个键一起使用 datetime 键产生了不正确的组键数量(GH 51158) -
DataFrameGroupBy.quantile()和SeriesGroupBy.quantile()中存在的错误,可能会在结果索引上隐式使用sort=False进行排序(GH 53009) -
SeriesGroupBy.size()中存在的错误,对于具有ArrowDtype或掩码 dtype(例如Int64)的数据,dtype 将为np.int64(GH 53831) -
DataFrame.groupby()中存在的错误,在结果 groupby 对象上进行列选择时,当通过由单个元素组成的列表进行分组时,未返回名称为元组的名称(GH 53500) -
DataFrameGroupBy.var()和SeriesGroupBy.var()中存在的错误,在使用 datetime64、timedelta64 或PeriodDtype值调用时未引发TypeError(GH 52128, GH 53045) -
DataFrameGroupBy.resample()中存在的错误,使用kind="period"时引发AttributeError(GH 24103) -
对于返回空对象的
Resampler.ohlc(),错误导致返回一个Series而不是空的DataFrame(GH 42902") -
当数据具有
ArrowDtype或掩码类型(例如Int64)时,SeriesGroupBy.count()和DataFrameGroupBy.count()中的错误导致数据类型为np.int64(GH 53831) -
对于使用
dropna="any"或dropna="all"时进行列选择后,SeriesGroupBy.nth()和DataFrameGroupBy.nth()中的错误导致不会对列进行子集化(GH 53518) -
对于使用
dropna="any"或dropna="all"时进行列选择后SeriesGroupBy.nth()和DataFrameGroupBy.nth()中的错误导致行被丢弃(GH 53518) -
对于
np.inf + np.inf和(-np.inf) + (-np.inf)分别相加后,SeriesGroupBy.sum()和DataFrameGroupBy.sum()中的错误导致结果为np.nan而不是np.inf和-np.inf(GH 53606) -
Series.groupby()中的错误,在分组的Series具有DatetimeIndex索引且by参数给定为月份名称的Series时引发错误(GH 48509)
重塑
-
concat()中的错误,在一个列具有pa.null()数据类型时,强制转换为object数据类型(GH 53702) -
crosstab()中的错误,当dropna=False时,结果中不会保留np.nan(GH 10772) -
melt()中的错误,variable列会丢失扩展数据类型(GH 54297) -
merge_asof()中的错误导致扩展数据类型引发KeyError(GH 52904) -
merge_asof()中的错误,对于由只读 ndarrays 支持的数据引发ValueError(GH 53513) -
merge_asof()中的错误,使用left_index=True或right_index=True且索引数据类型不匹配时,在某些情况下会给出不正确的结果,而不是引发MergeError(GH 53870�� -
merge()中的错误,在整数ExtensionDtype和浮点 NumPy 数据类型上合并时引发TypeError(GH 46178) -
DataFrame.agg()和Series.agg()中的错误,对非唯一列进行聚合时,当传递 dist-like 参数时返回的类型不正确(GH 51099) -
DataFrame.combine_first()中的错误,如果other为空,则忽略其他列(GH 53792) -
Bug in
DataFrame.idxmin()和DataFrame.idxmax(),在空帧时轴 dtype 将丢失(GH 53265) -
Bug in
DataFrame.merge()在具有单个级别的MultiIndex时未能正确合并(GH 52331) -
Bug in
DataFrame.stack()当列是MultiIndex且帧包含混合 dtype 时丢失扩展 dtype(GH 45740) -
Bug in
DataFrame.stack()对列进行字典排序时出现错误(GH 53786) -
Bug in
DataFrame.transpose()推断对象列的 dtype 时出现错误(GH 51546) -
Bug in
Series.combine_first()将int64dtype 转换为float64并在非常大的整数上丢失精度(GH 51764) -
Bug when joining empty
DataFrame对象时,连接的索引将是RangeIndex而不是连接的索引类型(GH 52777)
Sparse
-
Bug in
SparseDtype构造函数在给定不兼容的子类型 dtype 时未能引发TypeError,其子类型必须是 NumPy dtype(GH 53160) -
Bug in
arrays.SparseArray.map()允许填充值包含在稀疏值中(GH 52095)
ExtensionArray
-
Bug in
ArrowStringArray构造函数在字符串字典类型时引发ValueError(GH 54074) -
在使用字典给出具有扩展 dtype 的
Series时,DataFrame构造函数未复制的错误(GH 53744) -
ArrowExtensionArray中存在一个错误,将 pandas 的非纳秒时间对象从非零值转换为零值时出现问题(GH 53171) -
对于 PyArrow 时间类型,在
Series.quantile()中引发ArrowInvalid的错误(GH 52678) -
Series.rank()在Float64dtype 的小值上返回错误的顺序(GH 52471) -
Series.unique()中存在一个错误,对带有NA值的布尔ArrowDtype进行处理时出现问题(GH 54667) -
在
__iter__()和__getitem__()中返回非纳秒类型的 python datetime 和 timedelta 对象时存在问题(GH 53326) -
在使用
factorize()处理pyarrow.chunked_array的pyarrow.dictionary类型时,如果有多个 chunk,返回的唯一值不正确(GH 54844) -
将
ExtensionArray子类传递给dtype关键字时出现错误。现在将引发UserWarning以鼓励传递一个实例而不是一个子类(GH 31356, GH 54592) -
当列具有带有
pyarrow.ExtensionDtype的ArrowDtype时,DataFramerepr 不起作用的错误(GH 54063) -
对于带有遮罩的 ExtensionDtypes(例如
Float64Dtype、BooleanDtype),其__from_arrow__方法不接受pyarrow.null()类型的数组(GH 52223)
样式化器
- 在
Styler._copy()中调用Styler的子类中覆盖的方法时存在问题(GH 52728)
元数据
-
修复了
DataFrame.max()、DataFrame.min()、DataFrame.prod()、DataFrame.mean()、Series.mode()、DataFrame.median()、DataFrame.sem()、DataFrame.skew()、DataFrame.kurt()中的元数据传播问题(GH 28283) -
修复了
DataFrame.squeeze()和DataFrame.describe()中的元数据传播问题(GH 28283) -
修复了
DataFrame.std()中的元数据传播问题(GH 28283)
其他
-
在存在
NaN值时,FloatingArray.__contains__中的 Bug 错误地返回False(GH 52840) -
在存在
NaN值时,DataFrame和Series中的 Bug 引发数据为复杂 dtype 时的问题(GH 53627) -
在
DatetimeIndex中的 Bug,当传递带有时间的索引的repr时,如果时间为午夜且非基于日的频率,将不会打印时间(GH 53470) -
在
testing.assert_frame_equal()和testing.assert_series_equal()中的 Bug 现在对两个不相等的集合抛出断言错误(GH 51727) -
testing.assert_frame_equal()中的 bug 即使不检查索引类型也会检查类别 dtypes(GH 52126) -
api.interchange.from_dataframe()中的 bug 没有尊重allow_copy参数(GH 54322) -
api.interchange.from_dataframe()中的 bug 在转换非 pandas tz-aware 数据且包含空值时出现异常(GH 54287) -
在转换空 DataFrame 对象时
api.interchange.from_dataframe()中的 bug(GH 53155) -
在
from_dummies()中的 bug 导致生成的Index与原始Index不匹配(GH 54300) -
在
from_dummies()中的 bug 导致生成的数据始终是objectdtype 而不是列的 dtype(GH 54300) -
在
DataFrameGroupBy.first()、DataFrameGroupBy.last()、SeriesGroupBy.first()和SeriesGroupBy.last()中的 bug 导致空组返回np.nan而不是对应的ExtensionArrayNA 值(GH 39098) -
DataFrame.pivot_table()中的 Bug,将整数的平均值强制转换回整数时出错(GH 16676)。 -
DataFrame.reindex()中的 Bug,在应该推断为ExtensionDtype的fill_value时,错误地推断为objectdtype(GH 52586)。 -
DataFrame.shift()中的 Bug,在具有单个ExtensionDtype列的DataFrame上,使用axis=1时给出不正确的结果(GH 53832)。 -
Index.sort_values()中的 Bug,在传递key时出错(GH 52764)。 -
Series.align()、DataFrame.align()、Series.reindex()、DataFrame.reindex()、Series.interpolate()、DataFrame.interpolate()中的 Bug,在使用method=”asfreq”时未能正确抛出错误(GH 53620)。 -
Series.argsort()中的 Bug,在传递无效的axis时未能抛出错误(GH 54257)。 -
Series.map()中的 Bug,当对空系列使用可调用对象时,返回的系列具有objectdtype。现在保留原始 dtype(GH 52384)。 -
Series.memory_usage()中的 Bug,当deep=True时,针对对象系列抛出错误,并且返回值不正确,因为它未考虑 GC 校正(GH 51858)。 -
period_range()中的错误,当未传递freq作为参数时,默认行为是不正确的(GH 53687) -
修复了
pandas._libs.json的__name__属性不正确的问题(GH 52898)
Categorical
-
CategoricalIndex.remove_categories()中的错误,有序类别将不会被维护(GH 53935) -
Series.astype()中的错误,对于具有只读空值掩码的可空数组,使用dtype="category"时(GH 53658) -
Series.map()中的错误,如果系列持有一个Categorical,则na_action参数的值不会被使用(GH 22527)
Datetimelike
-
DatetimeIndex.map()中的na_action="ignore"现在按预期工作(GH 51644) -
DatetimeIndex.slice_indexer()现在对非单调索引引发KeyError,如果切片边界中的任一边界不在索引中;此行为先前已被弃用,但处理不一致(GH 53983) -
DateOffset中的错误,当将DateOffset对象乘以一个常数时,行为不一致(GH 47953) -
date_range()中的错误,当freq是带有nanoseconds的DateOffset时(GH 46877) -
to_datetime()中的错误,将包含 PyArrow 时间戳的Series或DataFrame转换为 numpy 日期时间(GH 52545) -
DatetimeArray.map()和DatetimeIndex.map()中的错误,提供的可调用函数是数组级别操作而不是元素级别操作(GH 51977) -
在使用 PyArrow 支持的日期类型时,
DataFrame.to_sql()引发ValueError的 Bug (GH 53854) -
Timestamp.date()、Timestamp.isocalendar()、Timestamp.timetuple()和Timestamp.toordinal()中存在的 Bug 返回了 Python 标准库 datetime 模块不支持的输入的错误结果 (GH 53668) -
Timestamp.round()在接近实现边界的值时返回错误结果而不是引发OutOfBoundsDatetime的 Bug (GH 51494) -
从日期时间或时间间隔标量构造
Series或DataFrame时总是推断纳秒分辨率而不是根据输入推断的 Bug (GH 52212) -
从不带日期的时间表示字符串构造
Timestamp时推断出错误单位的 Bug (GH 54097) -
使用
ts_input=pd.NA构造Timestamp时引发TypeError的 Bug (GH 45481) -
解析带有星期但没有日期的日期时间字符串的 Bug,例如 “2023 年 9 月 星期四”,错误地引发
AttributeError而不是ValueError(GH 52659) -
当 dtype 是时区感知日期时间且不是纳秒分辨率时,
Series的 repr 中存在的 Bug 引发OutOfBoundsDatetime(GH 54623)
Timedelta
-
TimedeltaIndex除法或乘法中存在的 Bug 导致.freq为 “0 天” 而不是None(GH 51575) -
在
Timedelta中存在 Bug,对于 NumPytimedelta64对象未能正确引发ValueError(GH 52806) -
在
to_timedelta()中存在 Bug,将包含pyarrow.duration的Series或DataFrame转换为 NumPytimedelta64(GH 54298) -
在
Timedelta.__hash__()中存在 Bug,在某些大值的秒分辨率上引发OutOfBoundsTimedelta(GH 54037) -
在
Timedelta.round()中存在 Bug,对接近实现边界的值返回不正确的结果而不是引发OutOfBoundsTimedelta(GH 51494) -
在
TimedeltaIndex.map()中存在 Bug,使用na_action="ignore"(GH 51644) -
在
arrays.TimedeltaArray.map()和TimedeltaIndex.map()中存在 Bug,提供的可调用函数以数组方式而不是元素方式操作 (GH 51977)
时区
-
在
infer_freq()中存在 Bug,对于时区感知时间戳的Series引发TypeError(GH 52456) -
在
DatetimeTZDtype.base()中存在 Bug,始终返回带纳秒分辨率的 NumPy dtype (GH 52705)
数值
-
在
RangeIndex中存在 Bug,在被减数为数值时设置step不正确 (GH 53255) -
在
Series.corr()和Series.cov()中存在 Bug,对于屏蔽的 dtype 引发AttributeError(GH 51422) -
在调用
Series.kurt()和Series.skew()时存在 Bug,对于全零的 NumPy 数据返回 Python 类型而不是 NumPy 类型 (GH 53482) -
Series.mean()和DataFrame.mean()中的 Bug,包含可以转换为数字的字符串的 object-dtype 值(例如“2”)返回不正确的数字结果;现在会引发TypeError(GH 36703, GH 44008) -
DataFrame.corrwith()中的 Bug,对于 PyArrow-backed dtypes 引发NotImplementedError(GH 52314) -
DataFrame.size()和Series.size()中的 Bug,返回 64 位整数而不是 Python int (GH 52897) -
DateFrame.dot()中的 Bug,返回ArrowDtype数据的objectdtype (GH 53979) -
Series.any(),Series.all(),DataFrame.any()和DataFrame.all()中的 Bug,bool_only的默认值设置为None而不是False;这一更改不应对用户产生影响(GH 53258) -
Series.corr()和Series.cov()中的 Bug,对于蒙版 dtype 引发AttributeError(GH 51422) -
Series.median()和DataFrame.median()中的 Bug,包含可以转换为数字的字符串的 object-dtype 值(例如“2”)返回不正确的数字结果;现在会引发TypeError(GH 34671) -
Series.sum()中的 Bug,将 dtypeuint64转换为int64(GH 53401)
转换
-
DataFrame.style.to_latex()和DataFrame.style.to_html()中的 Bug,如果 DataFrame 包含的整数位数比浮点双精度所能表示的位数更多,会出现问题(GH 52272) -
array()中的 Bug 在给定单位为“s”、“us”或“ms”的datetime64或timedelta64dtype 时返回NumpyExtensionArray而不是DatetimeArray或TimedeltaArray(GH 52859) -
array()中的 Bug 在给定空列表且无 dtype 时返回NumpyExtensionArray而不是FloatingArray(GH 54371) -
ArrowDtype.numpy_dtype()中的 Bug 在非纳秒单位的pyarrow.timestamp和pyarrow.duration类型中返回纳秒单位(GH 51800) -
DataFrame.__repr__()中的 Bug 在某一列的 dtype 为np.record时错误地引发TypeError(GH 48526) -
DataFrame.info()中的 Bug 在设置use_numba时引发ValueError错误(GH 51922) -
DataFrame.insert()中的 Bug,如果loc是np.int64,会引发TypeError错误(GH 53193) -
HDFStore.select()中的 Bug 在存储和检索时丢失大整数的精度(GH 54186) -
Series.astype()中的 Bug 不支持object_类型(GH 54251)
字符串
区间
-
当
target是只读数组时,IntervalIndex.get_indexer()和IntervalIndex.get_indexer_nonunique()会引发异常(GH 53703) -
在删除时,
IntervalDtype存在错误,对象可能被保留(GH 54184) -
在使用浮点
step时,interval_range()存在错误,会产生不正确的区间(GH 54477)
索引
-
在将
DataFrame设置为重复列时,DataFrame.__setitem__()存在错误,会丢失 dtype(GH 53143) -
当使用布尔掩码和混合非数值 dtype 以及值不是
NaN时,DataFrame.__setitem__()和DataFrame.putmask()存在错误,错误地引发TypeError(GH 53291) -
当将
nan作为唯一元素时,DataFrame.iloc()存在错误(GH 52234) -
在将
Series分配给objectdtypeSeries的预定义索引时,Series.loc()存在错误,将Series转换为np.dnarray(GH 48933)
缺失
-
当
method为"pad","ffill","bfill", 或"backfill"时,DataFrame.interpolate()存在错误,无法填充数据(GH 53898) -
当
DataFrame为空时,DataFrame.interpolate()存在错误,忽略inplace(GH 53199) -
当包含
NaT的DatetimeIndex索引的Series.idxmin()、Series.idxmax()、DataFrame.idxmin()、DataFrame.idxmax()中存在 bug,错误地返回NaN而不是NaT(GH 43587) -
在无效的
downcast关键字上失败未引发异常的Series.interpolate()和DataFrame.interpolate()中存在 bug,该关键字只能为None或"infer"(GH 53103) -
具有复杂 dtype 的
Series.interpolate()和DataFrame.interpolate()中存在 bug,错误地未正确填充NaN条目(GH 53635)
MultiIndex
I/O
-
当给定非默认
Index时,DataFrame.to_orc()现在会引发ValueError(GH 51828) -
当使用 SQLAlchemy 连接时,参数
name留空时DataFrame.to_sql()现在会引发ValueError(GH 52675) -
json_normalize()中的 bug 无法解析元数据字段列表类型(GH 37782) -
read_csv()中的错误,当parse_dates设置为列表或字典且engine="pyarrow"时会出错(GH 47961) -
read_csv()中的错误,使用engine="pyarrow"时,指定dtype和index_col时引发错误(GH 53229) -
read_hdf()中的错误,在引发IndexError后未正确关闭存储(GH 52781) -
read_html()中的错误,样式元素被读入 DataFrame 中(GH 52197) -
read_html()中的错误,尾部文本与包含display:none样式的元素一起被移除(GH 51629) -
read_sql_table()中的错误,在读取视图时引发异常(GH 52969) -
read_sql()中的错误,在读取具有相同列名的多个时区感知列时出错(GH 44421) -
read_xml()中的错误,剥离字符串数据中的空格(GH 53811) -
DataFrame.to_html()中的错误,在多级索引列的情况下错误应用colspace(GH 53885) -
DataFrame.to_html()中的错误,当空的DataFrame具有复杂 dtype 时会引发ValueError(GH 54167) -
DataFrame.to_json()中的错误,DateTimeArray/DateTimeIndex具有非纳秒精度时无法正确序列化(GH 53686) -
写入和读取空的 Stata dta 文件时出现的错误,dtype 信息丢失(GH 46240)
-
将
bz2视为硬性要求的错误(GH 53857)
Period
-
PeriodDtype构造函数中的 Bug 在没有传递参数或传递None时未能引发TypeError(GH 27388) -
在
PeriodDtype构造函数中,不正确地对不同的DateOffsetfreq输入返回相同的normalize的 Bug(GH 24121) -
在传递无效类型时,
PeriodDtype构造函数引发ValueError而不是TypeError的 Bug(GH 51790) -
在删除时保持对象的 Bug(GH 54184)
-
read_csv()中的 Bug 未将空字符串处理为空值,在使用engine="pyarrow"时出现此问题(GH 52087) -
使用
engine="pyarrow"时,read_csv()返回objectdtype 列而不是所有列都为 null 时返回float64dtype 列的 Bug(GH 52087) -
Period.now()中的 Bug 不接受freq参数作为关键字参数(GH 53369) -
在
na_action="ignore"下的PeriodIndex.map()中的 Bug(GH 51644) -
在
arrays.PeriodArray.map()和PeriodIndex.map()中,提供的可调用函数以数组方式而不是元素方式操作的 Bug(GH 51977) -
不正确地允许使用
CustomBusinessDay频率构造Period或PeriodDtype中的 Bug;应改用BusinessDay(GH 52534)
绘图
-
在使用
color=None调用Series.plot()时出现的 Bug(GH 51953) -
在使用
c="b"调用DataFrame.plot.scatter()时,修复了 UserWarning(GH 53908)
Groupby/resample/rolling
-
DataFrameGroupBy.idxmin(),SeriesGroupBy.idxmin(),DataFrameGroupBy.idxmax(),SeriesGroupBy.idxmax()在空的 DataFrameGroupBy 或 SeriesGroupBy 上使用时返回错误的数据类型(GH 51423)。 -
在可空数据类型上使用
DataFrame.groupby.rank()时,当传递na_option="bottom"或na_option="top"时存在 Bug(GH 54206)。 -
DataFrame.resample()和Series.resample()中,当在TimedeltaIndex上重采样时,不正确地允许非固定的freq(GH 51896)。 -
DataFrame.resample()和Series.resample()在重采样空数据时丢失时区信息(GH 53664)。 -
DataFrame.resample()和Series.resample()中,当值超出轴范围时,origin在重采样中没有效果(GH 53662)。 -
在指定
min_periods=0时,加权滚动聚合存在 Bug(GH 51449)。 -
DataFrame.groupby()和Series.groupby()中的 Bug,当分组后的Series或DataFrame的索引是DatetimeIndex、TimedeltaIndex或PeriodIndex时,且groupby方法的第一个参数是函数时,该函数会作用于整个索引而不是索引的每个元素 (GH 51979) -
DataFrameGroupBy.agg()中的 Bug,列表不遵守as_index=False(GH 52849) -
DataFrameGroupBy.apply()中的 Bug,在对分组后的输入DataFrame进行子集化后作为DataFrame应用时,如果给定的可调用函数返回的Series的索引不完全相同,会引发错误 (GH 52444) -
DataFrameGroupBy.apply()中的 Bug,在选择多列并提供返回np.ndarray结果的函数时,会引发TypeError(GH 18930) -
DataFrameGroupBy.groups()和SeriesGroupBy.groups()中的 Bug,在具有日期时间键和另一个键的情况下,产生了不正确数量的分组键 (GH 51158) -
DataFrameGroupBy.quantile()和SeriesGroupBy.quantile()中的错误可能会在sort=False的情况下隐式对结果索引进行排序(GH 53009) -
SeriesGroupBy.size()中的错误,对于具有ArrowDtype或掩码 dtype(例如Int64)的数据,dtype 将为np.int64(GH 53831) -
DataFrame.groupby()中的错误,在结果 groupby 对象上进行列选择时,当通过由单个元素组成的列表进行分组时,未返回名称为元组的情况(GH 53500) -
DataFrameGroupBy.var()和SeriesGroupBy.var()中的错误,在使用 datetime64、timedelta64 或PeriodDtype值调用时未引发TypeError(GH 52128, GH 53045) -
DataFrameGroupBy.resample()中的错误,使用kind="period"时引发AttributeError(GH 24103) -
Resampler.ohlc()中的错误,当返回空对象时返回一个Series而不是空的DataFrame(GH 42902) -
Bug in
SeriesGroupBy.count()和DataFrameGroupBy.count()当数据具有ArrowDtype或掩码类型(例如Int64)时,dtype 为np.int64(GH 53831) -
Bug in
SeriesGroupBy.nth()和DataFrameGroupBy.nth()在使用dropna="any"或dropna="all"进行列选择后不会对列进行子集化(GH 53518) -
Bug in
SeriesGroupBy.nth()和DataFrameGroupBy.nth()在使用dropna="any"或dropna="all"进行列选择后引发错误,导致行被丢弃(GH 53518) -
Bug in
SeriesGroupBy.sum()和DataFrameGroupBy.sum()将np.inf + np.inf和(-np.inf) + (-np.inf)分别求和为np.nan而不是np.inf和-np.inf(GH 53606) -
Bug in
Series.groupby()将一个带有DatetimeIndex索引的分组Series和一个月份作为名称的Series给定给by参数时引发错误(GH 48509)
重塑
-
Bug in
concat()当一个列具有pa.null()类型时,强制转换为object类型(GH 53702) -
crosstab()在dropna=False时,结果中不会保留np.nan(GH 10772) -
melt()存在错误,其中variable列将丢失扩展的 dtype(GH 54297) -
merge_asof()对于扩展 dtypes 引发KeyError(GH 52904) -
merge_asof()对于由只读 ndarrays 支持的数据引发ValueError(GH 53513) -
merge_asof()在left_index=True或right_index=True时,如果索引 dtypes 不匹配,则在某些情况下给出不正确的结果,而不是引发MergeError(GH 53870) -
merge()在整数ExtensionDtype和浮点数 NumPy dtype 上合并时引发TypeError(GH 46178) -
DataFrame.agg()和Series.agg()在非唯一列上存在的错误,当传入 dist 类似参数时,返回的类型不正确(GH 51099) -
DataFrame.combine_first()如果other为空,则会忽略其他列(GH 53792) -
DataFrame.idxmin()和DataFrame.idxmax()存在错误,其中轴的 dtype 将在空框架中丢失(GH 53265) -
DataFrame.merge()在具有单个级别的MultiIndex时未正确合并(GH 52331) -
DataFrame.stack()当列是MultiIndex且帧包含混合 dtype 时,将丢失扩展 dtypes(GH 45740) -
在
DataFrame.stack()中的 Bug,按字典顺序对列进行排序 (GH 53786) -
在
DataFrame.transpose()中的 Bug,推断对象列的 dtype (GH 51546) -
在
Series.combine_first()中的 Bug,将int64dtype 转换为float64并在非常大的整数上失去精度 (GH 51764) -
在连接空的
DataFrame对象时的 Bug,连接的索引会是RangeIndex而不是连接的索引类型 (GH 52777)
稀疏
-
在
SparseDtype构造函数中的 Bug,在其子类型的不兼容dtype时未能引发TypeError(GH 53160) -
在
arrays.SparseArray.map()中的 Bug 允许将填充值包含在稀疏值中 (GH 52095)
ExtensionArray
-
在
ArrowStringArray构造函数中的 Bug,在字符串的字典类型上引发ValueError(GH 54074) -
在
DataFrame构造函数中的 Bug,在字典中给定扩展 dtype 的Series时未进行复制 (GH 53744) -
在
ArrowExtensionArray中的 Bug,将 pandas 非纳秒时间对象从非零值转换为零值 (GH 53171) -
在
Series.quantile()中的 Bug,对 PyArrow 时间类型引发ArrowInvalid(GH 52678) -
在
Series.rank()中的 Bug,在具有Float64dtype 的小值中返回错误的顺序 (GH 52471) -
在具有
NA值的布尔ArrowDtype中的Series.unique()存在 Bug(GH 54667) -
在非纳秒 dtype 中的
__iter__()和__getitem__()中存在 Bug,返回 Python datetime 和 timedelta 对象(GH 53326) -
在返回具有多个块的
pyarrow.dictionary类型的pyarrow.chunked_array的factorize()中存在 Bug,返回不正确的唯一值(GH 54844) -
将
ExtensionArray子类传递给dtype关键字时存在 Bug。现在会引发UserWarning,以鼓励传递一个实例(GH 31356,GH 54592) -
当列具有带有
pyarrow.ExtensionDtype的ArrowDtype时,DataFramerepr 不起作用的 Bug(GH 54063) -
__from_arrow__方法在被遮蔽的 ExtensionDtypes(例如Float64Dtype,BooleanDtype)中存在的 Bug,不接受类型为pyarrow.null()的 PyArrow 数组(GH 52223)
Styler
- 在
Styler._copy()中存在 Bug,调用Styler的子类中重写的方法(GH 52728)
元数据
-
在
DataFrame.max()、DataFrame.min()、DataFrame.prod()、DataFrame.mean()、Series.mode()、DataFrame.median()、DataFrame.sem()、DataFrame.skew()、DataFrame.kurt()中修复了元数据传播(GH 28283) -
在
DataFrame.squeeze()和DataFrame.describe()中修复了元数据传播(GH 28283) -
在
DataFrame.std()中修复了元数据传播(GH 28283)
其他
-
FloatingArray.__contains__中的错误,当存在NaN值时,NaN项错误地返回False(GH 52840) -
DataFrame和Series中的错误,在存在NaN值时,对复杂 dtype 数据引发异常(GH 53627) -
DatetimeIndex中的错误,当带有时间的索引传递时,repr不打印时间为午夜和非基于日期的频率(GH 53470) -
testing.assert_frame_equal()和testing.assert_series_equal()中的错误,现在对两个不相等的集合抛出断言错误(GH 51727) -
testing.assert_frame_equal()中的错误,即使要求不检查索引类型,也会检查类别 dtype(GH 52126) -
api.interchange.from_dataframe()中的错误,未遵守allow_copy参数(GH 54322) -
api.interchange.from_dataframe()中的错误,在从包含空值的非 pandas tz-aware 数据进行交换时引发异常(GH 54287) -
在
api.interchange.from_dataframe()中的错误,当转换空的 DataFrame 对象时(GH 53155) -
在
from_dummies()中存在的一个 bug,结果Index与原始Index不匹配 (GH 54300) -
在
from_dummies()中存在的一个 bug,结果数据始终为objectdtype 而不是列的 dtype (GH 54300) -
在空组返回
np.nan而不是相应的ExtensionArrayNA 值的情况下,在DataFrameGroupBy.first()、DataFrameGroupBy.last()、SeriesGroupBy.first()和SeriesGroupBy.last()中存在的一个 bug (GH 39098) -
在将 ints 的均值转换回 int 时,
DataFrame.pivot_table()中存在的一个 bug (GH 16676) -
DataFrame.reindex()中存在的一个 bug,应该用ExtensionDtype推断fill_value,但错误地推断为objectdtype (GH 52586) -
当在具有单个
ExtensionDtype列的DataFrame上使用axis=1时,DataFrame.shift()中存在的一个 bug 会导致结果不正确 (GH 53832) -
当传递一个
key时,Index.sort_values()中存在的一个 bug (GH 52764) -
Bug in
Series.align(),DataFrame.align(),Series.reindex(),DataFrame.reindex(),Series.interpolate(),DataFrame.interpolate()在使用method=”asfreq”时错误地未引发异常(GH 53620) -
Bug in
Series.argsort()当传递无效的axis时未引发异常(GH 54257) -
Bug in
Series.map()当对空系列传递可调用对象时,返回的系列的dtype为object。现在保持原始dtype(GH 52384) -
Bug in
Series.memory_usage()当deep=True时,对包含对象的系列抛出错误,并且返回值不正确,因为未考虑 GC 修正(GH 51858) -
Bug in
period_range()当未传递freq参数时,默认行为是不正确的(GH 53687) -
修复了
pandas._libs.json的__name__属性不正确的问题(GH 52898)
贡献者
本次发布共有 266 人贡献了补丁。名字后带有“+”的人第一次贡献了补丁。
-
AG +
-
Aarni Koskela
-
Adrian D’Alessandro +
-
Adrien RUAULT +
-
Ahmad +
-
Aidos Kanapyanov +
-
Alex Malins
-
Alexander Seiler +
-
Ali Asgar +
-
Allison Kwan
-
Amanda Bizzinotto +
-
Andres Algaba +
-
Angela Seo +
-
Anirudh Hegde +
-
Antony Evmorfopoulos +
-
Anushka Bishnoi
-
ArnaudChanoine +
-
Artem Vorobyev +
-
Arya Sarkar +
-
Ashwin Srinath
-
Austin Au-Yeung +
-
Austin Burnett +
-
Bear +
-
Ben Mangold +
-
Bernardo Gameiro +
-
Boyd Kane +
-
Brayan Alexander Muñoz B +
-
Brock
-
Chetan0402 +
-
Chris Carini
-
ChristofKaufmann
-
Clark-W +
-
Conrad Mcgee Stocks
-
Corrie Bartelheimer +
-
Coulton Theuer +
-
D067751 +
-
Daniel Isaac
-
Daniele Nicolodi +
-
David Samuel +
-
David Seifert +
-
Dea Leon +
-
Dea María Léon
-
Deepyaman Datta
-
Denis Sapozhnikov +
-
Dharani Akurathi +
-
DimiGrammatikakis +
-
Dirk Ulbricht +
-
Dmitry Shemetov +
-
Dominik Berger
-
Efkan S. Goktepe +
-
Ege Özgüroğlu
-
Eli Schwartz
-
Erdi +
-
Fabrizio Primerano +
-
Facundo Batista +
-
Fangchen Li
-
Felipe Maion +
-
Francis +
-
Future Programmer +
-
Gabriel Kabbe +
-
Gaétan Ramet +
-
Gianluca Ficarelli
-
Godwill Agbehonou +
-
Guillaume Lemaitre
-
Guo Ci
-
Gustavo Vargas +
-
Hamidreza Sanaee +
-
HappyHorse +
-
Harald Husum +
-
Hugo van Kemenade
-
Ido Ronen +
-
Irv Lustig
-
JHM Darbyshire
-
JHM Darbyshire (iMac)
-
JJ +
-
Jarrod Millman
-
Jay +
-
Jeff Reback
-
Jessica Greene +
-
Jiawei Zhang +
-
Jinli Xiao +
-
Joanna Ge +
-
Jona Sassenhagen +
-
Jonas Haag
-
Joris Van den Bossche
-
Joshua Shew +
-
Julian Badillo
-
Julian Ortiz +
-
Julien Palard +
-
Justin Tyson +
-
Justus Magin
-
Kabiir Krishna +
-
Kang Su Min
-
Ketu Patel +
-
Kevin +
-
Kevin Anderson
-
Kevin Jan Anker
-
Kevin Klein +
-
Kevin Sheppard
-
Kostya Farber
-
LM +
-
Lars Lien Ankile +
-
Lawrence Mitchell
-
Liwei Cai +
-
Loic Diridollou
-
Luciana Solorzano +
-
Luke Manley
-
Lumberbot (aka Jack)
-
Marat Kopytjuk +
-
Marc Garcia
-
Marco Edward Gorelli
-
MarcoGorelli
-
Maria Telenczuk +
-
MarvinGravert +
-
Mateusz Sokół +
-
Matt Richards
-
Matthew Barber +
-
Matthew Roeschke
-
Matus Valo +
-
Mia Reimer +
-
Michael Terry +
-
Michael Tiemann +
-
Milad Maani Jou +
-
Miles Cranmer +
-
MirijaH +
-
Miyuu +
-
Natalia Mokeeva
-
Nathan Goldbaum +
-
Nicklaus Roach +
-
Nicolas Camenisch +
-
Nikolay Boev +
-
Nirav
-
Nishu Choudhary
-
Noa Tamir
-
Noy Hanan +
-
Numan +
-
Numan Ijaz +
-
Omar Elbaz +
-
Pandas Development Team
-
Parfait Gasana
-
Parthi
-
Patrick Hoefler
-
Patrick Schleiter +
-
Pawel Kranzberg +
-
Philip
-
Philip Meier +
-
Pranav Saibhushan Ravuri
-
PrathumP +
-
Rahul Siloniya +
-
Rajasvi Vinayak +
-
Rajat Subhra Mukherjee +
-
Ralf Gommers
-
RaphSku
-
Rebecca Chen +
-
Renato Cotrim Maciel +
-
Reza (Milad) Maanijou +
-
Richard Shadrach
-
Rithik Reddy +
-
Robert Luce +
-
Ronalido +
-
Rylie Wei +
-
SOUMYADIP MAL +
-
Sanjith Chockan +
-
Sayed Qaiser Ali +
-
Scott Harp +
-
Se +
-
Shashwat Agrawal
-
Simar Bassi +
-
Simon Brugman +
-
Simon Hawkins
-
Simon Høxbro Hansen
-
Snorf Yang +
-
Sortofamudkip +
-
Stefan Krawczyk
-
Stefanie Molin
-
Stefanie Senger
-
Stelios Petrakis +
-
Stijn Van Hoey
-
Sven
-
Sylvain MARIE
-
Sylvain Marié
-
Terji Petersen
-
Thierry Moisan
-
Thomas
-
Thomas A Caswell
-
Thomas Grainger
-
Thomas Li
-
Thomas Vranken +
-
Tianye Song +
-
Tim Hoffmann
-
Tim Loderhose +
-
Tim Swast
-
Timon Jurschitsch +
-
Tolker-KU +
-
Tomas Pavlik +
-
Toroi +
-
Torsten Wörtwein
-
Travis Gibbs +
-
Umberto Fasci +
-
Valerii +
-
VanMyHu +
-
Victor Momodu +
-
Vijay Vaidyanathan +
-
VomV +
-
William Andrea
-
William Ayd
-
Wolf Behrenhoff +
-
Xiao Yuan
-
Yao Xiao
-
Yasin Tatar
-
Yaxin Li +
-
Yi Wei +
-
Yulia +
-
Yusharth Singh +
-
Zach Breger +
-
Zhengbo Wang
-
abokey1 +
-
ahmad2901 +
-
assafam +
-
auderson
-
august-tengland +
-
bunardsheng +
-
cmmck +
-
cnguyen-03 +
-
coco +
-
dependabot[bot]
-
giplessis +
-
github-actions[bot]
-
gmaiwald +
-
gmollard +
-
jbrockmendel
-
kathleenhang
-
kevx82 +
-
lia2710 +
-
liang3zy22 +
-
ltartaro +
-
lusolorz +
-
m-ganko +
-
mKlepsch +
-
mattkeanny +
-
mrastgoo +
-
nabdoni +
-
omar-elbaz +
-
paulreece +
-
penelopeysm +
-
potap75 +
-
pre-commit-ci[bot] +
-
raanasn +
-
raj-thapa +
-
ramvikrams +
-
rebecca-palmer
-
reddyrg1 +
-
rmhowe425 +
-
segatrade +
-
shteken +
-
sweisss +
-
taytzehao
-
tntmatthews +
-
tpaxman +
-
tzehaoo +
-
v-mcoutinho +
-
wcgonzal +
-
yonashub
-
yusharth +
-
Ádám Lippai
-
Štěpán Műller +


浙公网安备 33010602011771号