I wish to create a column just like this:
İn Excel this can be done easily where the remaining rows can be auto-filled. How to achieve the same in python using pandas?
CodePudding user response:
Use f-strings with zero fill values:
df['new'] = [f'abc_{n 1:02}' for n in range(len(df))]
If default index is possible add 1, convert to strings and add str.zfill:
df['new'] = 'abc_' (df.index 1).astype(str).str.zfill(2)

