-1

Well I am trying to create a dataframe in pandas and print it reading a csv file, however it is not pretty displayed

This is the code:

import pandas as pd
df = pd.read_csv("weather.csv")
print(df)

And this is my output:

And this is my output (image)

What can I do?

Ali_Sh
  • 2,667
  • 3
  • 43
  • 66
  • Be sure to have https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html open for further reference :) – creanion Jun 25 '22 at 14:21

2 Answers2

2

A sample of weather.csv would help but I believe that this will solve the issue:

import pandas as pd
df = pd.read_csv("weather.csv", sep=';')
print(df)
Ilya
  • 730
  • 4
  • 16
2

Next time try to provide your data in text. You need to change separator, default is ','. So try this:

df = pd.read_csv('weather.csv', sep=';')
Kiryl
  • 611
  • 6
  • 7