-
-
Save ksv-muralidhar/b77e7ff8b301110663d3eea323c76c7c to your computer and use it in GitHub Desktop.
reshape
This file contains 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
df.melt() |
This file contains 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
df_melt = df.melt(id_vars='Particulars') | |
df_melt |
This file contains 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
df_melt = df.melt(id_vars='Particulars', | |
var_name="Year", | |
value_name="Amount") | |
df_melt |
This file contains 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
df_melt.pivot(index="Particulars", | |
columns="Year", | |
values="Amount").reset_index() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment