简体   繁体   中英

Display Same Row Number In Two Seperate Columns In Pandas Dataframe

I have a csv that I'm working with right now that fundamentally looks something like this (see picture).

Sample CSV 示例 CSV

What I'd like to be able to output is the corresponding row in the UTC Time column for the Value 1, 2, or 3 column when it exceeds a threshold eg print all rows in UTC Time and the values of Value 2 when it exceeds 2. In this case, it would print:

1/1/2018 13:40 3
1/1/2018 13:41 4
...

Right now it's just print T/F when I do something like this:

df['UTC Time'].where(Value 2 > 2)

你可以试试:

 df[['UTC Time','Value 2']][df['Value 2']>2]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM