在熊猫数据框图中获取当前的组名称
有这样的数据
Timestamp Function_code Node_id Delta
0 2000-01-01 10:39:51.790683 Tx_PDO_2 54 551.0
1 2000-01-01 10:39:51.791650 Tx_PDO_2 54 601.0
2 2000-01-01 10:39:51.792564 Tx_PDO_3 54 545.0
3 2000-01-01 10:39:51.793511 Tx_PDO_3 54 564.0
我
框Windows,X轴上的Timestamp
的图形,delta
在y轴上。一个用于tx_pdo_2
,另一个用于tx_pdo_3
:
delta_rx_tx_df.groupby("Function_code").plot(x="Timestamp", y="Delta", )
现在,我想知道哪个窗口对应于哪个function_code_code
我尝试使用title = delta_rx_tx_df.groupby(“ function_code”)。组
,但它不起作用。
I have a data frame like that (it's just the head) :
Timestamp Function_code Node_id Delta
0 2000-01-01 10:39:51.790683 Tx_PDO_2 54 551.0
1 2000-01-01 10:39:51.791650 Tx_PDO_2 54 601.0
2 2000-01-01 10:39:51.792564 Tx_PDO_3 54 545.0
3 2000-01-01 10:39:51.793511 Tx_PDO_3 54 564.0
There are only two types of Function_code
: Tx_PDO_2
and Tx_PDO_3
I plot in two windows, a graph with Timestamp
on the x-axis and Delta
on the y-axis. One for Tx_PDO_2
and the other for Tx_PDO_3
:
delta_rx_tx_df.groupby("Function_code").plot(x="Timestamp", y="Delta", )
Now, I want to know which window corresponds to which Function_code
I tried to use title=delta_rx_tx_df.groupby("Function_code").groups
but it did not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能有一种更好的方法,但是对于初学者来说,您可以在创建它们后将标题分配给图:
There may be a better way, but for starters, you can assign the titles to the plots after they are created: