+ 1

import excel file as csv to python(jupyter notebook) help please

I used this code import pandas as pd df=pd.read_csv(r'C:\Users\Student\Videos\transaction.csv') df Yes the data is imported but it is not a perfect table it shifted on one side columns don't correspond with rows.please help me what to do

7th Dec 2022, 2:38 AM
Lindelani Mathenjwa
Lindelani Mathenjwa - avatar
2 Réponses
+ 4
CSV file format is very fuzzy, even the structure and the encoding can have big variances. So it may not be trivial, how to import it into a DataFrame. Without seeing the actual data, which is obviously on your local machine, it's not possible to give more specific hints. You can look at the pandas documentation and maybe you can figure out, which additional parameter of read_csv you need to set, in order to process the file correctly. https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
7th Dec 2022, 5:02 AM
Tibor Santa
Tibor Santa - avatar
+ 3
Lindelani Mathenjwa , without having seen the *.csv file it is difficult to help you. > try to copy the content of the file and paste it in a python file in playground. save file and place the link to it in your post. do not modify anything in this file. > if the file has more then 20 lines, just copy / paste the first 20 lines. > if you are allowed you can also share a link to the original csv file for download.
7th Dec 2022, 12:06 PM
Lothar
Lothar - avatar