pandas

df按列排序：
```python
cec_df.sort_values('CEC', inplace=True)
```

df添加一列：
```python
df.insert(0, 'molecule', df0['molecule']) # 0为指定的位置
```

分组：
```python
dfgp = df.groupby(df['Event'])
events = [_ for _, x in dfgp]
groups = [x for _, x in dfgp]
```

reset_index:
```python
sub_df = df.iloc[locs[i]:locs[i+1]].reset_index(drop=True)
```

df filter by a column:
```python
annoate_result = result.where(result['group'] != 'normal').dropna()[:20].reset_index(drop=True)
pcc_df1 = all_pcc_df[all_pcc_df['corof'].isin(sm_lst1)]
```

filter startswith:
```python
li_df = lipid_df.where(lipid_df['molecule'].str.startswith(lipid_items)).dropna()
```

dropna():
```
ndf = df.dropna(subset=['序号'])
```

df add row:
```python
df.loc[len(df)]=pd.Series(index=df.columns.values)
```

id: ec1ac407bcf84229a1de58aa1a7af264
parent_id: 9d7dcef08524420294b71e944c674660
created_time: 2022-11-07T12:46:21.787Z
updated_time: 2023-06-14T14:49:33.649Z
is_conflict: 0
latitude: 31.82059200
longitude: 117.22721900
altitude: 0.0000
author: 
source_url: 
is_todo: 0
todo_due: 0
todo_completed: 0
source: joplin-desktop
source_application: net.cozic.joplin-desktop
application_data: 
order: 0
user_created_time: 2022-11-07T12:46:21.787Z
user_updated_time: 2023-06-14T14:49:33.649Z
encryption_cipher_text: 
encryption_applied: 0
markup_language: 1
is_shared: 0
share_id: 
conflict_original_id: 
master_key_id: 
type_: 1