BergelsonLab / BergelsonLab/blabpy

add function to easily concatenate dataframe

Open
#20 0 comments 0 reactions 1 assignee Claimed by @kalenkovich View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.