Last active
May 29, 2021 11:43
-
-
Save AayushSameerShah/69aa327d583ce6c841172671830e2868 to your computer and use it in GitHub Desktop.
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
'''There can be a situation while cleaning the data | |
you might want ot replace one dataframe's value on | |
certain indices with other df's values (usually cl- | |
eared ones) based on the index - This MIGHT help. | |
2 Solutions.''' | |
# 1. Great - Almost all time will work | |
df.col_to_change.update(df.col_new_value) | |
' As both are Series - this will work! ' | |
# 2. Other work around | |
df1['col_to_replace'].fillna(df2['all_values_col']) | |
# The point is - You can use ↑ in fillna! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment