0

I have the following pandas

Time    Vehicle1    Vehicle2
0   86.0    17.0    3.0
1   90.0    17.0    8.0
2   91.0    17.0    8.0
3   92.0    17.0    8.0
4   92.0    17.0    8.0

I would like to merge the columns according to all three columns value, hence, the result should be

Time    Vehicle1    Vehicle2
0   86.0    17.0    3.0
1   90.0    17.0    8.0
2   91.0    17.0    8.0
3   92.0    17.0    8.0

I've tried res=res.groupby(["Time", "Vehicle1","Vehicle2"]), however, I get the same dataframe as shown first, what I'm doing wrong?

  • You need `drop_duplicates`, not `groupby`. – jezrael Nov 15 '21 at 09:20
  • Not exactly sure, what you're trying to achieve, but try adding a method to your groupby ```res.groupby(["Time", "Vehicle1","Vehicle2"])["Time"].value_counts()``` – botivegh Nov 15 '21 at 10:59

0 Answers0