简体   繁体   中英

Column Pandas Dataframe not transposing

I start off by importing a giant CSV that was originally an .xls and then start breaking up the imported data into their specific columns.

data = pd.read_csv('csv_acrylic_arranged.csv')

X_wavelength = data.iloc[:, 0]

y_2287 = data.iloc[:, 8] 
y_2092 = data.iloc[:, 10]

y_2208 = data.iloc[:, 19]
y_373 = data.iloc[:, 21]

y_2051 = data.iloc[:, 30]
y_9092 = data.iloc[:, 32]

y_2146 = data.iloc[:, 41]
y_2424 = data.iloc[:, 43]

And it goes on until I get to the like 170th column - I only realized after I could have just done a for loop :(

But when I want to reformat the data into a new CSV. So since all these y_VALUE are in columns, I would need to transpose and concat. When I check the concat its the same values as before! 在此处输入图片说明

I was super dumb you can just go

pd.DataFrame(data = y_XXXX) = r_XXXX
r_XXXX = r_XXXX.T

Thanks everyone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM