Reputation: 587
I have a .csv file that has (45211rows, 1columns). but i need to create new .scv file with (45211rows, 17columns)
These are the column names age;"job";"marital";"education";"default";"balance";"housing";"loan";"contact";"day";"month";"duration";"campaign";"pdays";"previous";"poutcome";"y"
I add a screenshot of the .csv file that I already have.
Upvotes: 0
Views: 1085
Reputation: 569
In pandas, the read_csv
method has an option for setting the separator, which is ,
by default. To override, you can:
pandas.read_csv(<PATH_TO_CSV_FILE>, sep=';', header=0)
This will return a new dataframe with the correct format. The header=0
might not be needed, but it will force the returned dataframe to read the first line of the CSV file as column headers
Upvotes: 1
Reputation: 81
Upvotes: 0