Importing “.csv” Files Using Jupyter Notebook
This will be my second blog post describing how to import CSV (Comma separated values) files into your desired platform to work with. My first post discusses how to import data into Google Colaboratory, a link to it can be found here. In this post I will be explaining methods for working specifically with Jupyter Notebook.
Both of the methods that I will discuss require pandas to work successfully, you can use the cell found below to import it. You will also want to have the file or files that you’re trying to work with to be in an easy to locate file path.
After you have imported pandas you will want to acquire the file path of your CSV file. Instructions on how to do this can be found here for Windows, and then for Macs. Once you have the file path copied you will want to use the code cell below to read in your file, it is important you include the “r” at the start of your file path.
This method is quite literally the same as the first, the only differences are that you don’t need to include the “r”. Once again to start, you will need pandas imported. After that you will still need to acquire your file path, after you have it copied and ready to paste, you will want to make sure to use double backslashes “ \\ ” as seen in the cell below.
Hopefully one of these methods give you a helpful insight into your file importing process!
Data Analysis: Loading Data from CSV & Excel Files in Jupyter Notebook
The first stage of data analysis is getting the data. Today with this tutorial we will see an easy and fast way to import our data in Jupyter Notebook.
To loading our CSV files or excel files, we will use Jupyter. If you don’t know what is it Jupyter, don’t worry; you can find some information about in my previous article click here Anaconda&Jupyter.
Thanks to Jupyter and Anaconda, with just a few lines of code, we will be able to import data
in the following formats:
- CSV
- Excel
- SQL (I will explain this in the next article)
Let’s see how to:
Import CSV Data:
Suppose to have a csv file with name data, you need to write this 4 code lines to get you data
Import Excel Data:
The method to import Excel data in Jupyter it’s really similar like as the method to import CSV data.

That’s all my friends !
In the next article we will see how to save data in CSV and Excel files, and how to combine Excel file.
How to load CSV file in Jupyter Notebook?
I’m new and studying machine learning. I stumble upon a tutorial I found online and I’d like to make the program work so I’ll get a better understanding. However, I’m getting problems about loading the CSV File into the Jupyter Notebook.
I get this error:
and here is the code: 
I followed tutorials online regarding this error but none worked. Does anyone know how to fix it?
3rd attempt with r»path» 
I’ve tried also «\» and utf-8 but none worked.
I’m using the latest version of Anaconda Windows 7 Python 3.7
![]()
12 Answers 12
Use raw string notation for your Windows path. In python ‘\’ have meaning in python. Try instead do string like this r»path»:
student_data = pd.read_csv(r»C:\Users\xxxx\Desktop\student-intervention- system\student-data.csv»)
If it doesnt work try this way:
Either replace all backslashes \ with frontslashes / or place a r before your filepath string to avoid this error. It is not a matter of your folder name being too long.
As Bohun Mielecki mentioned, the \ character which is typically used to denote file structure in Windows has a different function when written within a string.
From Python3 Documentation: The backslash \ character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.
How this particularly affects your statement is that in the line
\Users matches the escape sequence \Uxxxxxxxx whereby xxxxxxxx refers to a Character with 32-bit hex value xxxxxxxx . Because of this, Python tries to find a 32-bit hex value. However as the -sers from Users doesn’t match the xxxxxxxx format, you get the error:
SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape
The reason why your code works now is that you have placed a r in front of ‘C:\Users\xxxx\Desktop\project\student-data.csv’ . This tells python not to process the backslash character / as it usually does and read the whole string as-is.
I hope this helps you better understand your problem. If you need any more clarification, do let me know.
Insightlist
3. Потом вызываем содержимое файла в таком виде с такими двумя слешами!

Второй способ открыть csv файл в Jupyter notebook уже без загрузки pandas выглядит так:
Если выгружать csv файл из Google-analytics там не только все в кучу, но еще и слетает кодировка.