-1

When I try to output my table csv table, it looks horrible. What should I do?

I tried just putting it in, but it's really messy.

import pandas as pd 
df = df.read_csv(r"C:\yourpath\data.csv")

df

enter image description here

I want to get something more readable such as:

enter image description here

I tried putting some formatting in the excel file, but it doesn't seem to save this things because of the csv format

brenodacosta
  • 389
  • 2
  • 13
teabussin
  • 3
  • 2
  • Hi, welcome to StackOverflow. Please take the [tour](https://stackoverflow.com/tour) and learn [How to Ask](https://stackoverflow.com/help/how-to-ask). In order to get help, you will need to provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). If your question includes a pandas dataframe, please provide a [reproducible pandas example](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – alec_djinn Jul 05 '23 at 07:15
  • you need the `sep=';'` parameter documented here: https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html – toppk Jul 05 '23 at 07:17
  • Hi! Your problem is less the output but more the import of the csv file. Your example does not look like pandas got the columns right, so please refer to the pandas help page https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html. A a guess, I think you need to include `names` and `sep` to correctly read your data. – R. C. Jul 05 '23 at 07:20

1 Answers1

0
import pandas as pd 
df = df.read_csv(r"C:\yourpath\data.csv", sep=";")

df
brenodacosta
  • 389
  • 2
  • 13
  • Answer needs supporting information 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](https://stackoverflow.com/help/how-to-answer). – moken Jul 05 '23 at 13:00