如图,对于tau这一列,希望能把它拆分成两列,一列为
另一列为
也就是左边分成一列,右边分成一列
import pandas as pd
data = [[768944800,[1,3],0,1.5360],
[768944800,[2,4],0,1.5360]]
df = pd.DataFrame(data, columns=['0','tau','3','4'])
print(df,'\n','-----------------------------------------------')
df['tau_left']=[df['tau'][i][0] for i in range(len(df))]
df['tau_right']=[df['tau'][i][1] for i in range(len(df))]
print(df,'\n','-----------------------------------------------')
df_new = pd.DataFrame(df, columns=['0','tau_left','tau_right','3','4'])
print(df_new,'\n','-----------------------------------------------')