我和你一起工作虹膜鳞片用于分析目的的数据集。但在处理过程中,如何在读取数据文件后获得切片列值
df = pd.read_csv("../Data/iris.scale.csv", sep=' ', header=None, names=['class','S.lenght','S.width','P.lenght','P.width'])
print(df.head(3))
class S.lenght S.width P.lenght P.width
1 1:-0.555556 2:0.25 3:-0.864407 4:-0.916667
1 1:-0.666667 2:-0.166667 3:-0.864407 4:-0.916667
1 1:-0.833333 2:-0.08333 3:-0.830508 4:-0.916667
但是如何得到这些切片的列,比如这个没有任何特征引用的列,这样就可以进行处理了
class S.lenght S.width P.lenght P.width
1 -0.555556 0.25 -0.864407 -0.916667
1 -0.666667 -0.166667 -0.864407 -0.916667
1 -0.833333 -0.08333 -0.830508 -0.916667
在给熊猫喂食之前对数据进行预处理,去除多余的数据
然后,您可以在将数据馈送给Pandas之前将其写入新文件,或者将其放入类似文件的对象中,然后将其馈送给Pandas。你知道吗
您可以使用^{} 来创建} 提取,最后一次转换输出到
DataFrame
,其中值只有:
由^{float
:另一个带有^{} 的解决方案:
pandas
filter
关注正确的列stack
+str.split
+unstack
update
代码
numpy
split
一次完成整个数组代码
相关问题 更多 >
编程相关推荐