0.23.1中的新特性(2018年6月12日)#

这是0.23.x系列中的一个较小的错误修复版本,包括一些小的回归修复和错误修复。我们建议所有用户升级到此版本。

警告

从2019年1月1日开始,Pandas功能发布将只支持Python3。看见 Dropping Python 2.7 想要更多。

固定回归#

将Series与DateTim.Date进行比较

我们已将0.23.0更改恢复为比较 Series 保存日期时间和一个 datetime.date 对象 (GH21152 )。在Pandas0.22和更早版本中,将保存日期时间的序列与 datetime.date 对象会迫使 datetime.date 设置为日期时间,然后再进行比较。这与Python、NumPy和 DatetimeIndex ,它从不考虑日期时间和 datetime.date 平起平坐。

在0.23.0中,我们统一了DatetimeIndex和Series之间的操作,并在此过程中更改了一系列DateTime和 datetime.date 毫无征兆地。

我们暂时恢复了0.22.0的行为,所以日期时间和日期可能再次相等,但在未来的版本中恢复0.23.0的行为。

总而言之,0.22.0、0.23.0、0.23.1中的行为如下:

# 0.22.0... Silently coerce the datetime.date
>>> import datetime
>>> pd.Series(pd.date_range('2017', periods=2)) == datetime.date(2017, 1, 1)
0     True
1    False
dtype: bool

# 0.23.0... Do not coerce the datetime.date
>>> pd.Series(pd.date_range('2017', periods=2)) == datetime.date(2017, 1, 1)
0    False
1    False
dtype: bool

# 0.23.1... Coerce the datetime.date with a warning
>>> pd.Series(pd.date_range('2017', periods=2)) == datetime.date(2017, 1, 1)
/bin/python:1: FutureWarning: Comparing Series of datetimes with 'datetime.date'.  Currently, the
'datetime.date' is coerced to a datetime. In the future pandas will
not coerce, and the values not compare equal to the 'datetime.date'.
To retain the current behavior, convert the 'datetime.date' to a
datetime with 'pd.Timestamp'.
  #!/bin/python3
0     True
1    False
dtype: bool

此外,排序比较将引发 TypeError 在未来。

其他修复

  • 恢复了 to_sql() 执行多值插入,因为这在某些情况下会导致回归 (GH21103 )。在未来,这将成为可配置的。

  • 修复了 DatetimeIndex.dateDatetimeIndex.time 支持时区的数据的属性: DatetimeIndex.time 返回Tz感知时间,而不是Tz-naive (GH21267 )和 DatetimeIndex.date 当输入日期具有非UTC时区时,返回错误的日期 (GH21230 )。

  • Fixed regression in pandas.io.json.json_normalize() when called with None values in nested levels in JSON, and to not drop keys with value as None (GH21158, GH21356).

  • 窃听 to_csv() 指定压缩和编码时导致编码错误 (GH21241GH21118 )

  • 通过-OO优化阻止Pandas进口的错误 (GH21071 )

  • 窃听 Categorical.fillna() 错误地引发 TypeError 什么时候 value 各个类别是可迭代的,并且 value 是一个可迭代的 (GH21097GH19788 )

  • Fixed regression in constructors coercing NA values like None to strings when passing dtype=str (GH21083)

  • 回归到 pivot_table() 在那里订购了一个 Categorical 缺少透视表的值 index 将产生未对齐的结果 (GH21133 )

  • 修复了对布尔索引/列进行合并时的回归 (GH21119 )。

性能改进#

  • Improved performance of CategoricalIndex.is_monotonic_increasing(), CategoricalIndex.is_monotonic_decreasing() and CategoricalIndex.is_monotonic() (GH21025)

  • Improved performance of CategoricalIndex.is_unique() (GH21107)

错误修复#

Groupby/resample/rolling

Data-type specific

Sparse

  • Bug in SparseArray.shape which previously only returned the shape SparseArray.sp_values (GH21126)

Indexing

Plotting

  • 新的关键字(Sharx、Shary),用于打开/关闭由Pandas.DataFrame().groupby().boxlot()生成的子图共享x/y轴 (GH20968 )

I/O

  • IO方法中指定的错误 compression='zip' 它产生了未压缩的Zip档案 (GH17778GH21144 )

  • 窃听 DataFrame.to_stata() 阻止将DataFrame导出到缓冲区和大多数类似文件的对象 (GH21041 )

  • 窃听 read_stata()StataReader 它无法从Stata 14文件(DTA版本118)中正确解码Python3上的UTF-8字符串 (GH21244 )

  • IO JSON中的错误 read_json() 使用读取空JSON架构 orient='table' 返回到 DataFrame 导致错误 (GH21287 )

Reshaping

  • 窃听 concat() 连接过程中引发错误的位置 Series 具有乏味的标量和元组名称 (GH21015 )

  • 窃听 concat() 警告消息为未来行为提供了错误的指导 (GH21101 )

Other

  • 制表符完成打开 Index 在IPython中,不再输出弃用警告 (GH21125 )

  • 在未安装C++可再发行组件的情况下阻止在Windows上使用Pandas的错误 (GH21106 )

贡献者#

共有30人为此次发布贡献了补丁。名字中带有“+”的人第一次贡献了一个补丁。

  • Adam J. Stewart

  • Adam Kim +

  • Aly Sivji

  • Chalmer Lowe +

  • Damini Satya +

  • Dr. Irv

  • Gabe Fernando +

  • Giftlin Rajaiah

  • Jeff Reback

  • Jeremy Schendel +

  • Joris Van den Bossche

  • Kalyan Gokhale +

  • Kevin Sheppard

  • Matthew Roeschke

  • Max Kanter +

  • Ming Li

  • Pyry Kovanen +

  • Stefano Cianciulli

  • Tom Augspurger

  • Uddeshya Singh +

  • Wenhuan

  • William Ayd

  • chris-b1

  • gfyoung

  • h-vetinari

  • nprad +

  • ssikdar1 +

  • tmnhat2001

  • topper-123

  • zertrin +