خرید بک لینک

Vote count: 0

I am saving to a .csv file a preprocessed file with pandas to_csv() function as follows:

retu df.to_csv(output_file, sep = '|')

The output of the .csv file looks like this:

|id|content|content2
0|id1|some content|some content
1|id1|some content|some content
....
n|idn|more content|even more content

As you can see from the above pandas objetct, the columns are not well formed:

|id|content|content2

How can I remove the above columns and replace them for this new columns setting:

id|content|content2

In other words:

id|content|content2
id1|some content|some content
id1|some content|some content
....
idn|more content|even more content

I all ready tried with:

df = pd.read_csv(output_file, sep='|', index_col=1)[['id','content', 'content2']]

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 7 خرداد 1395 ساعت: 5:09

صفحه بندی