python pandas将一列拆分为多列

 

import pandas as pd
df = pd.DataFrame([["A006, R079, 00-00-04, 5 AVE-59 ST"]])
print(df)
df2 = pd.DataFrame(df[0].str.split(',').tolist())
print(df2)
                                   0
0  A006, R079, 00-00-04, 5 AVE-59 ST
      0      1          2             3
0  A006   R079   00-00-04   5 AVE-59 ST

Process finished with exit code 0

 

你可能感兴趣的:(python)