Using for loop in Python to add leading zeros to date column
Here you go (without loop):
df["Month"] = df.Month.map("{:02}".format)
You can try this:
df = pd.read_csv('file.csv', converters={'Month': '{:0>2}'.format}).astype('str')print(df)
Here you go (without loop):
df["Month"] = df.Month.map("{:02}".format)
You can try this:
df = pd.read_csv('file.csv', converters={'Month': '{:0>2}'.format}).astype('str')print(df)