Can't read csv file on Jupyter notebook - python

I can't open a CSV file on Jupyter Notebook. Every time I try to open up, I get this...
Any suggestions or advice would be much appreciated!

The issue is with the forward slashes in your path. Change them to double backslashes:
C:/Users/nsap/desktop...
to
C:\\Users\\nsap\\desktop
Please see this stackoverflow link for more info Error while reading a csv file in python using pandas

Related

Unable to save dataframe in Jupyterlab to CSV/Excel

I'm trying to export a dataframe in Jupyterlab. The command runs but I don't see the file on my desktop.
I'm trying this but I don't find the file. I've even tried to_excel version but that doesn't work either. Any help, pls.
df_busu.to_csv(r'C:\Users\Admin\Desktop\app_play_store.csv')
try to save without raw string format and inverting the "" to "/".
`df_busu.to_csv("C:/Users/.../file.csv"; sep=";")`
that's how a export a file to csv from pandas in Win10.

how to get the JSON code of a .ipynb file?

I have a problem when I try to open an Ipynb file in Jupyter lab, I get this error :
Unreadable notebook [...] NotJSONError("Notebook does not appear to be JSON: ''...")
I get this error even if I create the file with Jupyter lab directly
I already tried to update Jupyter and to update Nodejs but nothing change.
Before I had this problem I didn't even know that ipynb files were made with JSON so I am a bit lost.
does anyone know how I can get the JSON code of my Ipynb file?
You can validate the .ipynb file with a JSON validator: like this one

Unreadable Notebook: C:\file path UnicodeDecodeError('utf-8) for Jupyter Notebook

I am trying to open a notebook file that I was working on 3 days ago, however, I get the following error Unreadable Notebook: C:\file path UnicodeDecodeError('utf-8) for Jupyter Notebook. How can I get this file to work again.
I've reinstalled Anaconda and tried opening the file on different computers but it still doesn't work
I just had this problem and this is what worked for me.
Open the problem notebook in a text editor and copy all the text. Open a new file in your text editor and paste in the text, then save the file. In my case the text editor did not have the option to save as a Jupyter Notebook, so I saved as .txt.
Move the file into your Jupyter area. Rename it so the ending is .ipynb and not .txt. Then open the file as a notebook.
As I read through the now-working notebook I saw some comments had what looked like Chinese characters in them. I don't know exactly what happened there to make those appear but if you used Ctrl+/ to comment like I do then it's possible that is where the issue is in your notebook. So if my janky method of converting file types does not work for you and you still really want to save your notebook enough to manually dig through all the markup and text then you can try checking your comments in the file to see if there are odd characters in there.

How do you import a CSV file in Jupyter Notebook?

I'm a beginner programmer and I'm trying to import a CSV file into Jupyter Notebook. I am following the instruction on this article link. However when I change the file used on the link to my file I get this error Error Image. How should I go about addressing this issue?
Carry your .csv file to the same directory with your notebook (If you use windows as OS, it probably will be in C:\Users\your username as default). Then you better call your data file by pandas.read_csv()

Why can't I open this csv file I downloaded and what are these errors?

I'm new to Pandas and I was beginning to run a simple code to work with this CSV file I downloaded from the government portal. Here's my code -
import pandas as pd
df = pd.read_excel(r'C:\Users\ADMIN\Desktop\Abhishek')
print(df.head)
The path is correct and it didn't work without adding the r at the beginning so I used that. However, this code results in these errors and I'm not sure how to handle any of them.
I've opened the file on Excel and I don't think there's any problem with it. What am I doing wrong?
Python doesn't have permission to open the file. Run your interpreter as administrator, or adjust permissions.
Right click your python shell and select "run as administrator".

Categories