选择熊猫的条件下的特定列
我有一个带有3列的数据框:
df = DataFrame(query, columns=["Processid", "Processdate", "ISofficial"])
在下面的代码中,我基于ProcessID == 204(没有列名)获得了ProcessDate:
result = df[df.Processid == 204].Processdate.to_string(index=False)
但是我会一次对两个列的结果相同,没有列名,类似于下面的代码:
result = df[df.Processid == 204].df["Processdate","ISofficial"].to_string(index=False)
我知道如何超过结果,但我不想要列名,索引和数据类型。 有人可以帮忙吗?
I have a below Dataframe with 3 columns:
df = DataFrame(query, columns=["Processid", "Processdate", "ISofficial"])
In Below code, I get Processdate based on Processid==204 (without Column Names):
result = df[df.Processid == 204].Processdate.to_string(index=False)
But I wan the same result for Two columns at once without column names, Something like below code:
result = df[df.Processid == 204].df["Processdate","ISofficial"].to_string(index=False)
I know how to get above result but I dont want Column names, Index and data type.
Can someone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您正在寻找
header
into_string
参数。将其设置为false
。I think you are looking for
header
argument into_string
parameters. Set it toFalse
.