命令 - df = pd.concat([df, df["XYZ"].apply(pd.Series)], axis=1)
错误-
FutureWarning:在未来的版本中,空系列的默认 dtype 将是“object”而不是“float64”。明确指定数据类型以消除此警告。
XYZ 是一个带有 Ordered Dictionary 的列,并尝试使用此命令提取特定值。 命令工作正常,但会引发未来警告。
明确指定数据类型以消除此警告。
您可能会隐式地告知
dtype
应该使用什么pd.Series
以下方式
import functools
import pandas as pd
Float64Series = functools.partial(pd.Series,dtype="float64")
s = Float64Series([1,2,3,4,5]) # these would be turned into int64 if you would use pd.Series
print(s)
给出输出
0 1.0
1 2.0
2 3.0
3 4.0
4 5.0
dtype: float64
观察
.0
s 并且 dtype
是 float64
.