Created
February 17, 2015 22:12
-
-
Save wrobstory/16bcd8386287615b3733 to your computer and use it in GitHub Desktop.
Pandas rename
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [60]: df = pd.DataFrame({"foo": [1, 2], "bar": [3, 4]}) | |
In [61]: df.rename({"foo": "foo_1", "bar": "bar_1"}) | |
Out[61]: | |
bar foo | |
0 3 1 | |
1 4 2 | |
In [62]: df.rename(columns={"foo": "foo_1", "bar": "bar_1"}) | |
Out[62]: | |
bar_1 foo_1 | |
0 3 1 | |
1 4 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment