I want use the first 5 rows of my data frame and concentrate the string to form a new index.
Doing some research i think groupby with agg and lambda will work. What would be the best way to accomplish this? I am new to python.
For example my current data frame:
Dataframe (df):
| a | b | c | d | e | f |
|---|---|---|---|---|---|
| fixed | variable | electric | |||
| Cost | Cost | Power | Max | Min | |
| receipt | Unit | Unit | Another header | Rate | Rate |
| delivery zone | Rate | Rate | Rate | 1 | 1/2 |
| $ | $ | $ | $ | $ | |
| 5 | 2 | 3 | 3 | 3 | 3 |
| 5 | 2 | 3 | 3 | 3 | 3 |
Desired Outcome:
| receipt delivery zone | fixed cost unit rate | variable cost unit rate | electric Power Another header Rate | Max Rate | Min Rate |
|---|---|---|---|---|---|
| 5 | 2 | 3 | 3 | 3 | 3 |
| 5 | 2 | 3 | 3 | 3 | 3 |