BergelsonLab / BergelsonLab/blabpy
add function to easily concatenate dataframe
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
I often do `pd.concat` with a key for each dataframe which I want to be added as an extra column. Pandas then creates a two-level index with the keys as the first level and each dataframe's original index as the second one. I very rarely care about the original index, so I then have to remove it. I have to look up a way to do it easily every time so it'd be a good idea to have a little helper function.
Here is what I usually do
```py
(pd.concat(objs=dfs,
keys=keys,
names=[, 'index'])
.reset_index('index', drop=True)
.reset_index(, drop=False)
)
```
Here is what I want to do instead:
```py
concat_with_key(dfs=dfs, keys=keys, name=)
```
Contributor guide
Assessment
This issue has not been assessed yet.