Rename Columns
df has columns nm and pr. Return a DataFrame with the same rows where nm is renamed to name and pr is renamed to price.
Example 1
df {"nm":["pen"],"pr":[2]}
returns {"columns":["name","price"],"rows":[["pen",2]]}
Same data, new column names.
Constraints
- The tables are small
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Running Sales TotalBeginner
- Sorted Unique ValuesBeginner
- Swap the LabelsBeginner
- Table ShapeBeginner
- Top ScoresBeginner
- Upper QuartileBeginner
- Wanted StatusesBeginner
- Add Total ColumnEasy