Pandas `替换为'didn';数据帧无法正常工作 范围索引:2356个条目,0到2355 数据列(共4列): #列非空计数数据类型 --- ------ -------------- ----- 0 doggo 2356非空对象 1 Floorfer 2356非空对象 2木偶2356非空对象 3 puppo 2356非空对象 数据类型:对象(4) 内存使用率:73.8+KB
我的代码出了什么问题,我试图用Pandas `替换为'didn';数据帧无法正常工作 范围索引:2356个条目,0到2355 数据列(共4列): #列非空计数数据类型 --- ------ -------------- ----- 0 doggo 2356非空对象 1 Floorfer 2356非空对象 2木偶2356非空对象 3 puppo 2356非空对象 数据类型:对象(4) 内存使用率:73.8+KB,pandas,Pandas,我的代码出了什么问题,我试图用NaN替换'None'字符串,但没有成功。你有没有示例输入/输出来重现这个问题?Twitter\u Archive.iloc[:,13:::.astype(str).replace({'None':np.NaN},inplace=True)?是None实际上是一个字符串还是None对象?>Twitter\u Archive.iloc[:,13:].astype(str).replace({'None':np.nan},inplace=True)@MrNobody33
NaN
替换'None'字符串,但没有成功。你有没有示例输入/输出来重现这个问题?Twitter\u Archive.iloc[:,13:::.astype(str).replace({'None':np.NaN},inplace=True)
?是None
实际上是一个字符串还是None
对象?>Twitter\u Archive.iloc[:,13:].astype(str).replace({'None':np.nan},inplace=True)
@MrNobody33不起作用。>是None
实际上是一个字符串还是None
对象?这就是type
python函数向我显示的内容,它将None
检测为str
typetype(Twitter\u Archive.iloc[0,13])
您是否有示例输入/输出来重现这一点?Twitter\u Archive.iloc[:,13:.astype(str).替换({'None':np.nan},inplace=True)
?是None
实际上是一个字符串还是None
对象?>Twitter\u Archive.iloc[:,13:].astype(str).replace({'None':np.nan},inplace=True)
@MrNobody33不起作用。>是None
实际上是一个字符串还是None
对象?这就是type
python函数向我展示的内容,它将None
检测为str
typetype(Twitter\u Archive.iloc[0,13])
Twitter_Archive.iloc[:,13:].replace({'None':np.nan},inplace=True)
Twitter_Archive.iloc[:,13:].info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2356 entries, 0 to 2355
Data columns (total 4 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 doggo 2356 non-null object
1 floofer 2356 non-null object
2 pupper 2356 non-null object
3 puppo 2356 non-null object
dtypes: object(4)
memory usage: 73.8+ KB