I have a CSV file containing a string of numbers like this:
1.0,2.0,1.0,1.0,1.0,2.0....
I want to read it in but make a new row for each ",". Can't find how to do that while using pd.read_csv, any suggestions?
Thank you!
You can read_csv without header and transpose the dataframe:
pd.read_csv('yourfile.csv', header=None).T
output:
0
0 1.0
1 2.0
2 1.0
3 1.0
4 1.0
5 2.0
Transposing a similar to Matrix Transpose where you switch rows with columns. So all your columns become rows and rows become columns.
In the code above, We're first reading the csv file as one row but then we are calling .T which is transposing all columns as rows.