1
raptium 2017-02-20 22:19:43 +08:00 via iPhone
groupby min
|
2
raptium 2017-02-20 22:20:50 +08:00 via iPhone
或者 sort_values 然后 drop_duplicates
|
3
kingmo888 2017-02-21 00:11:58 +08:00
```
import pandas as pd data = [[1,1,1,2,3,3], [0.2,0.3,0.4,0.1,0.2,0.4]] data = pd.DataFrame(data) data = [[1,1,1,2,3,3], [0.2,0.3,0.4,0.1,0.2,0.4]] data = pd.DataFrame(data).T data.columns=['A', 'B'] data.groupby('A').max() ``` |
4
staticor 2017-02-21 09:37:40 +08:00 1
推荐 groupby('A', as_index=False)['B'].min() 比较直接.
另外也推荐看一看 pivot_table 函数, 更是强大. ``` df.pivot_table(index='A', columns=None, values='B', aggfunc=min) ``` |