I have a dataframe with one column consisting of string values like "asdb.sdsb". Is there a simple method/function where I can remove the "." in all the values in the column. Thanks.
Use .replace
:
df = pd.DataFrame({"col1": ["asdb.asdb", "xyz.xyz"]})
Which is dataframe:
col1
0 asdb.asdb
1 xyz.xyz
Then:
df["col1"] = df["col1"].str.replace(r"\.", "")
print(df)
Prints:
col1
0 asdbasdb
1 xyzxyz
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.