1.2.2 中的新特性 (2021 年 2 月 9 日)#

以下是 pandas 1.2.2 中的变化。请参阅 版本说明 获取完整的更新日志,包括其他版本的 pandas。

已修复的回归问题#

  • 修复了 read_excel() 中的回归问题,该问题导致在检查旧版本 xlrd 时引发 AttributeError (GH 38955)

  • 修复了 DataFrame 构造函数中的回归问题,该问题导致从 dtype 不是 "datetime64[ns]" 的 datetime ndarray 构造时重新排序元素 (GH 39422)

  • 修复了 DataFrame.astype()Series.astype() 中未能转换为 bytes dtype 的回归问题 (GH 39474)

  • 修复了 to_pickle() 中未能使用 protocol=5 创建 bz2/xz 压缩的 pickle 文件的问题 (GH 39002)

  • 修复了 pandas.testing.assert_series_equal()pandas.testing.assert_frame_equal() 中在比较扩展 dtype 时总是引发 AssertionError 的回归问题 (GH 39410)

  • 修复了 to_csv() 中的回归问题,该问题导致以二进制模式而非文本模式打开 codecs.StreamWriter 并忽略用户提供的 mode (GH 39247)

  • 修复了 Categorical.astype() 中的回归问题,该问题导致在将 np.int32 传递给 dtype 参数时转换为错误的 dtype (GH 39402)

  • 修复了 to_excel() 中的回归问题,该问题导致在追加 (mode="a") 到现有文件时创建损坏的文件 (GH 39576)

  • 修复了 DataFrame.transform() 中的回归问题,该问题导致在空 DataFrame 或 Series 的情况下失败 (GH 39636)

  • 修复了 groupby()resample() 中的回归问题,该问题导致在聚合全 NaN 或数值对象 dtype 列时出现错误 (GH 39329)

  • 修复了 Rolling.count() 中的回归问题,该问题导致操作后 min_periods 参数被设置为 0 (GH 39554)

  • 修复了 read_excel() 中的回归问题,该问题导致在参数 io 既不是路径也不是缓冲区且指定了参数 engine 时错误地引发异常 (GH 39528)

错误修复#

  • pandas.read_excel() 在指定 sheetname 不存在时的错误消息现在在不同引擎下保持一致 (GH 39250)

  • 修复了 pandas.read_excel() 中的错误,该错误导致在使用引擎 openpyxl 且 Excel 文件丢失或维度信息不正确时产生错误的结果;此修复需要 openpyxl >= 3.0.0,早期版本仍可能失败 (GH 38956, GH 39001)

  • 修复了 pandas.read_excel() 中的错误,该错误导致在使用引擎 openpyxl 时有时会产生带有尾部 np.nan 行的 DataFrame (GH 39181)

贡献者#

共有 14 人为此次发布贡献了补丁。名字旁带有“+”的人员是首次贡献补丁。

  • Andrew Wieteska

  • Erfan Nariman

  • Joris Van den Bossche

  • Matthew Roeschke

  • MeeseeksMachine

  • Pandas 开发团队

  • Pav A

  • Richard Shadrach

  • Simon Hawkins

  • Thomas Li

  • Torsten Wörtwein

  • Vladimir Podolskiy +

  • jbrockmendel

  • patrick