Python dataframe to csv - 1 line of code

已完成 已发布的 7 年前 货到付款
已完成 货到付款

I have a dataframe I was storing into a csv and it worked perfectly fine. now I need to take each row from that dataframe and store it into a different csv file based upon the name of the first column in each row.

ds = DataFrame(data)

#I used the following

for index, row in [url removed, login to view]()

sname=row['1st_column_name']

with open('filename/'+sname+'.csv, 'a') as f:

row.to_csv(f, index=false,header=false)

it worked perfect and is storing the data however, its storing each row from that dataframe as a column and not as 1 row in the csv file. So the task is that I need the data to be store all in one row and not each piece of data having its own row.

currently store - value1

value2

value3

i need data stored - value1, value2, value3

Python

项目ID: #11432748

关于项目

4个方案 远程项目 活跃的7 年前

授予:

pbq

hi easy task for me. i can do this for you. i am proficient in python/pandas dataframe/csv. pls reply to start immediately.

$10 USD 在1天内
(4条评论)
3.8