Where is the Output error?

Asked

Viewed 83 times

-1

I am using the Pandas library (from Python).

I opened my CSV file with head function(),

However, the output obtained has the data/values all together.

Where is the bug/ How can I fix?

código

  • 1

    Important you [Dit] your post reducing to a [mcve] and putting text information as text and not as image.

1 answer

1


Looks like your CSV is split by a semicolon (';') and not by comma (','), which is the standard of the function read_csv, just use the parameter sep=';', as follows:

df = pd.read_csv('diretorio_do_arquivo', sep=';')

Similarly, when your csv is divided by any other sign, spaces (' ') or tabs (' t') just pass the information to the parameter sep I recommend taking a look at the documentation of the function: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html

  • I tried, and it didn’t work. I also tried to put the engine='python', and again it didn’t work. Thanks for the help

  • By the image you have placed, your database is not a csv, but an Excel, in which case you should use the read_excel function

Browser other questions tagged

You are not signed in. Login or sign up in order to post.