Pandas Replace The Asterisk Sign From Two Columns In One Go
I have a called host.txt which further i'm parsing via pandas saving it again with current timestamp. Below is the code which works fine except timestamp: import pandas as pd #----
Solution 1:
you can use the replace method with regex=True as such
df[['Hostname', 'Aux Site']] = df[['Hostname', 'Aux Site']].replace({'\*': ''}, regex=True)
Notice that this is the 'replace' method, not the 'str.replace' one.
Post a Comment for "Pandas Replace The Asterisk Sign From Two Columns In One Go"