1
$\begingroup$

After uploading the dataset, using the df.columns, and df.info commands. Columns names and info not showing properly on the page, so resolve this problem what is the solution?

*problem such as this-not set all words properly column-wise

<bound method DataFrame.info of Restaurant ID Restaurant Name Country Code City
0 6317637 Le Petit Souffle 162 Makati City
1 6304287 Izakaya Kikufuji 162 Makati City
2 6300002 Heat - Edsa Shangri-La 162 Mandaluyong City
3 6318506 Ooma 162 Mandaluyong City
4 6314302 Sambo Kojin 162 Mandaluyong City

$\endgroup$

1 Answer 1

0
$\begingroup$

There is a potential solution to the problem. Your Pandas DataFrame encoding system might not be specified to UTF-8. In this case, you need to specify your Pandas DataFrame encoding system when using the 'read_csv' function. For example, to specify your encoding system, you can use this code:

import pandas as pd

# read the dataset with UTF-8 encoding
df = pd.read_csv('dataset.csv', encoding='utf-8')

# display column names and information
print(df.columns)
print(df.info())

Correct encoding system specifying helps pandas to read and display DataFrame.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.