0

I am trying to read a .csv file into a Python dataframe but it is showing null values.

The .csv file has columns separated by ;.

I am using this code:

import pandas as pd    
data = pd.read_csv('testfile.csv', sep = ';')

and this is the output:

enter image description here

All values are null and number of rows got doubled

3
  • Open up the csv in a text editor (like notepad++) and see what it looks like Commented Oct 30, 2021 at 6:22
  • updated in orignal question Commented Oct 30, 2021 at 6:25
  • 1
    data= pd.read_csv('testfile.csv' , sep = ';', encoding = 'UTF-16') it worked Commented Oct 30, 2021 at 6:26

1 Answer 1

1
data = pd.read_csv('testfile.csv', sep = ';' , encoding = 'UTF-16')
Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.