i wonder how save new pandas series csv file in different column. suppose have 2 csv files both contains column 'a'. have done mathematical function on them , create new variable 'b'.
for example:
data = pd.read_csv('filepath') data['b'] = data['a']*10 # , add value of data.b list b_list.append(data.b) this continue until of rows of first , second csv file has been reading.
i save column b in new spread sheet both csv files. example need result:
colum1(from csv1) colum2(from csv2) data.b.value data.b.value by using code:
pd.dataframe(np.array(b_list)).t.to_csv('file.csv', index=false, header=none) i won't preferred result.
i think need concat column data1 column data2 first:
df = pd.concat(b_list, axis=1) df.to_csv('file.csv', index=false, header=none)
Comments
Post a Comment