pandas column string first n characters

27

df1['StateInitial'] = df1['State'].str[:2]
print(df1)  

Comments

Submit
0 Comments