Issue
df.speed # so nice cause of autocomplete...
df['speed']
df.loc[:,'speed']
are returning my data like omitting the selected column name
Time
2022-07-27 11:33:16.279157 45.000000
2022-07-27 11:33:16.628157 44.928571
2022-07-27 11:33:17.093157 44.857143
2022-07-27 11:33:17.449157 44.785714
Why is that missing??
I want it like
df.filter(regex="speed")
which returns
speed
Time
2022-07-27 11:33:16.279157 45.000000
2022-07-27 11:33:16.628157 44.928571
2022-07-27 11:33:17.093157 44.857143
2022-07-27 11:33:17.449157 44.785714
2022-07-27 11:33:17.885157 44.714286
which means only this can nicely easily plot with correct naming of the value axis
df.filter(regex="speed").plot()
whereas
df.speed.plot(label="speed")
only works by using plt.legend()
Is there a convenient way to do it?
Solution
df['speed']
anddf.speed
return a Series.df[['speed']]
returns a DataFrame, which is what you're expecting.
Answered By - BeRT2me
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.