Last active
August 8, 2020 03:46
-
-
Save SolClover/aa9ef0fe89542b2be29b2c1496fe0f64 to your computer and use it in GitHub Desktop.
Copy Pandas DataFrame
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
# Create new DataFrame based on old DataFrame | |
# Note, in this example you will create a view. | |
# Hence, your future changes to new_df will affect old_df too | |
new_df=old_df | |
# To make an actual copy of a DataFrame use this. | |
# In this case, future changes to new_df will not have an impact on old_df | |
new_df=old_df.copy() | |
# Print top 5 records of your new DataFrame | |
new_df.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment