0

I have downloaded a database from Kaggle (Video games with ratings) but I can't open it with my Jupyter Notebook.

I start with these 2 lines code but it gives me an error...

 import pandas as pd
   df = pd.read_csv("Video_Game_Sales_with_Ratings.csv.xlsx")

UnicodeDecodeError Traceback (most recent call last) in () 1 import pandas as pd ----> 2 df = pd.read_csv("Video_Game_Sales_with_Ratings.csv.xlsx")

~\Anaconda3\lib\site-packages\pandas\io\parsers.py in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skipfooter, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision) 653 skip_blank_lines=skip_blank_lines) 654 --> 655 return _read(filepath_or_buffer, kwds) 656 657 parser_f.name = name

~\Anaconda3\lib\site-packages\pandas\io\parsers.py in _read(filepath_or_buffer, kwds)

2
  • Use pd.read_csv("Video_Game_Sales_with_Ratings.csv") Commented Nov 7, 2017 at 21:26
  • Hello ! Thanks for your quick reply @bhansa :) I did what you said but it gives me a new error : UnicodeDecodeError Traceback (most recent call last) pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_tokens (pandas_libs\parsers.c:14858)() pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_with_dtype (pandas_libs\parsers.c:17119)() pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._string_convert (pandas_libs\parsers.c:17347)() pandas/_libs/parsers.pyx in pandas._libs.parsers._string_box_utf8 (pandas_libs\pars Commented Nov 7, 2017 at 21:36

2 Answers 2

1

The file you are pointing at is an xlsx format. You need to save the file in csv format first and then import in into pandas. To convert xlxs to csv you can use excel or this applet: http://www.zamzar.com/convert/xlsx-to-csv/

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your quick reply !! :) I have changed the file in a csv format, but now it gives me another error : UnicodeDecodeError Traceback (most recent call last) pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_tokens (pandas_libs\parsers.c:14858)() ...
1

You can use:

pd.read_excel(file_name.xlsx) 

Instead of turning your file into CSV, you can directly open the excel file in your previous format and even if it doesn't work try to look at the path of your file and make adjustments accordingly.

I hope this helps :)

Comments

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.