I have a dataset, df, where within a column I would like to replace the blank spaces with a period.
Data
Date id
Q1 2022 a
Q2 2022 b
Desired
Date id
Q1.2022 a
Q2.2022 b
Doing
df.apply(lambda x: x.str.replace('','.'))
Any suggestion is appreciated
CodePudding user response:
Try with
df['Date'] = df['Date'].str.replace(' ', '.', regex=False)