1.0.2中的新特性(2020年3月12日)#
这些是Pandas1.0.2中的变化。看见 发行说明 获取完整的更改日志,包括其他版本的Pandas。
固定回归#
Groupby
修复了中的回归问题
groupby(..).agg()
它在帧上失败,MultiIndex
列和自定义函数 (GH31777 )Fixed regression in
groupby(..).rolling(..).apply()
(RollingGroupby
) where theraw
parameter was ignored (GH31754)修复了中的回归问题
rolling(..).corr()
使用时间偏移量时 (GH31789 )修复了中的回归问题
groupby(..).nunique()
它正在修改原始值,如果NaN
价值是存在的 (GH31950 )修复了中的回归问题
DataFrame.groupby
提高一名ValueError
从内部操作 (GH31802 )修复了中的回归问题
groupby(..).agg()
在空输入上额外调用用户提供的函数 (GH31760 )
I/O
修复了中的回归问题
read_csv()
其中encoding
某些类似文件的对象无法识别选项 (GH31819 )修复了中的回归问题
DataFrame.to_excel()
当columns
传递关键字参数 (GH31677 )修复了中的回归问题
ExcelFile
其中传入函数的流由析构函数关闭。 (GH31467 )修复了以下情况下的回归问题
read_pickle()
提出了一项UnicodeDecodeError
在阅读一份py27泡菜时MultiIndex
立柱 (GH31988 )。
Reindexing/alignment
Fixed regression in
Series.align()
whenother
is aDataFrame
andmethod
is notNone
(GH31785)Fixed regression in
DataFrame.reindex()
andSeries.reindex()
when reindexing with (tz-aware) index andmethod=nearest
(GH26683)Fixed regression in
DataFrame.reindex_like()
on aDataFrame
subclass raised anAssertionError
(GH31925)
Other
修复了连接中的回归问题
DatetimeIndex
或TimedeltaIndex
保存freq
在简单的情况下 (GH32166 )Fixed regression in
Series.shift()
withdatetime64
dtype when passing an integerfill_value
(GH32591)
使用可为空的布尔数组进行索引#
以前使用包含以下内容的可空布尔数组进行索引 NA
会引发一个 ValueError
但是,现在允许使用 NA
被视为 False
。 (GH31503 )
In [1]: s = pd.Series([1, 2, 3, 4])
In [2]: mask = pd.array([True, True, False, None], dtype="boolean")
In [3]: s
Out[3]:
0 1
1 2
2 3
3 4
Length: 4, dtype: int64
In [4]: mask
Out[4]:
<BooleanArray>
[True, True, False, <NA>]
Length: 4, dtype: boolean
pandas 1.0.0-1.0.1
>>> s[mask]
Traceback (most recent call last):
...
ValueError: cannot mask with array containing NA / NaN values
Pandas1.0.2
In [5]: s[mask]
Out[5]:
0 1
1 2
Length: 2, dtype: int64
错误修复#
Datetimelike
窃听
Series.astype()
不是为天真和知晓TZ而抄袭datetime64
数据类型 (GH32490 )Bug where
to_datetime()
would raise when passedpd.NA
(GH32213)Improved error message when subtracting two
Timestamp
that result in an out-of-boundsTimedelta
(GH31774)
Categorical
修复了以下错误
Categorical.from_codes()
不适当地引发了ValueError
当传递可为空的整数代码时。 (GH31779 )修复了以下错误
Categorical()
构造函数将引发TypeError
当给定包含以下内容的Numy数组时pd.NA
。 (GH31927 )Bug in
Categorical
that would ignore or crash when callingSeries.replace()
with a list-liketo_replace
(GH31720)
I/O
使用
pd.NA
使用DataFrame.to_json()
现在可以正确地输出空值,而不是空对象 (GH31615 )窃听
pandas.json_normalize()
当元路径中的值不可迭代时 (GH31507 )固定酸洗
pandas.NA
。以前返回了一个新对象,这破坏了依赖于NA
成为单身人士 (GH31847 )修复了使用可为空的无符号整数数据类型的拼花地板往返过程中的错误 (GH31896 )。
实验数据类型
修复了中的错误
DataFrame.convert_dtypes()
对于已在使用"string"
数据类型 (GH31731 )。修复了中的错误
DataFrame.convert_dtypes()
对于混合了整数和字符串的级数 (GH32117 )Fixed bug in
DataFrame.convert_dtypes()
whereBooleanDtype
columns were converted toInt64
(GH32287)修复了使用带有字符串dtype的切片索引器设置值的错误 (GH31772 )
修复了以下错误
pandas.core.groupby.GroupBy.first()
和pandas.core.groupby.GroupBy.last()
会引发一个TypeError
当包含组时pd.NA
在对象数据类型的列中 (GH32123 )修复了以下错误
DataFrameGroupBy.mean()
,DataFrameGroupBy.median()
,DataFrameGroupBy.var()
,以及DataFrameGroupBy.std()
会引发一个TypeError
在……上面Int64
数据类型列 (GH32219 )
Strings
使用
pd.NA
使用Series.str.repeat()
现在正确地输出空值,而不是引发向量输入的错误 (GH31632 )
Rolling
修正了在递减时间索引上使用可变窗口(由持续时间定义)的滚动操作 (GH32385 )。
贡献者#
共有25人为此次发布贡献了补丁。名字中带有“+”的人第一次贡献了一个补丁。
Anna Daglis +
Daniel Saxton
Irv Lustig
Jan Škoda
Joris Van den Bossche
Justin Zheng
Kaiqi Dong
Kendall Masse
Marco Gorelli
Matthew Roeschke
MeeseeksMachine
MomIsBestFriend
Pandas Development Team
Pedro Reys +
Prakhar Pandey
Robert de Vries +
Rushabh Vasani
Simon Hawkins
Stijn Van Hoey
Terji Petersen
Tom Augspurger
William Ayd
alimcmaster1
gfyoung
jbrockmendel