Quantcast
Channel: Get all max and min values from df.groupby.().size() result - Stack Overflow
Browsing all 3 articles
Browse latest View live
↧

Answer by Ammar Bin Aamir for Get all max and min values from...

You can simply do this:df.groupby(["col1"])["col3"].max()

View Article


Answer by jezrael for Get all max and min values from df.groupby.().size()...

Yiu can convert second level (col3) to column. so possible aggregate by GroupBy.agg with DataFrameGroupBy.idxmax and GroupBy.max:df1 = (df.groupby(["col1", "col3"]) .size() .reset_index(level=0)...

View Article

Get all max and min values from df.groupby.().size() result

I have dataframe like thisdf = pd.DataFrame({'col1' : ['MM1', 'MM1', 'MM1', 'MM2', 'MM2', 'MM2', 'MM4', 'MM4', 'MM4'],'col2' : ['S1', 'S1', 'S3', 'S3', 'S4', 'S4', 'S2', 'S2', 'S2'],'col3' :...

View Article
Browsing all 3 articles
Browse latest View live