Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 months ago.
Improve this question
I am trying to load a .csv file lying on my desktop using pandas on jupyter notebook and getting the following error:
What's the problem with the code? The same method works on windows. (I'm using ubuntu 16.04 LTS)
Try passing encoding='utf-8' argument in your read_csv function, like this:
data = pd.read_csv('file_name.csv', encoding='utf-8')
filepath = r"/home/aditisp/Documents/Untitled Folder/sonar_data.csv"
##the preceding r denotes a string literal
df = pd.read_csv(filepath)
print(df.head())
This worked for me.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 months ago.
Improve this question
I want to write a program that will run a few lines on any piece of data or string upon copying to clipboard, is there a way to do this? I cant find much information about it.
I found https://pyperclip.readthedocs.io/en/latest/index.html
It has the pyperclip.waitForPaste() function, which should do exactly what you want. I had issues trying it with Linux Fedora, but it should be no problem on most Systems.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
newRow = ["some_data", "some_data", "=MULTIPLY(A1;BA)"]
When I'm trying this, in my google sheet, the cell in filled by : '=MULTIPLY(O33;M33) as a string. How can I make my equation usable ?
Remove the "" in your code will do the trick
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I am performing a machine learning implementation on a data given in json format.
I haven't tried much because I have no experience.
My code to read is:
with open('attempts.json') as my_file:
d = json.load(my_file)
I am getting error like:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I have replaced my attempts.json file which was 260mb to grades.json which is 12kb but still having same problem.
Your json file must have content and the format is correct.
Based on this error, I think your json file is empty.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I am having a hard time opening a csv with Pandas. I have tried the example in 'Pandas for Everyone' book, have googled many times and last example was here https://analytics4all.org/2016/05/09/python-read-csv-and-excel-with-pandas/
The python program is in a folder called 'lbcsv' then the csv files are in another folder within that one called csv. I have tried not using full path, placing csv file in same folder as the program, then moving them to another folder in the same directory. Just does not seem to want to open the csv. I have tried without the encoding and sep. Before this I had to uninstall pandas and numpy then reinstall because it was giving an error about numpy. I have got around this before but did not ask the question on here so I have no documentation of how I did so.
import pandas as pd
import numpy
servers = pd.read_csv('C:\\Users\\a089673\\Desktop\\lbcsv\\csv\\server.csv', encoding='utf-8', sep=',')
print(servers.head())
Traceback (most recent call last):
File "C:/Users/a089673/Desktop/lbcsv/pandaslb.py", line 4, in <module>
servers = pd.read_csv('C:\\Users\\a089673\\Desktop\\lbcsv\\csv\\server.csv', encoding='utf-8', sep=',')
FileNotFoundError: File b'C:\\Users\\a089673\\Desktop\\lbcsv\\csv\\server.csv' does not exist
For completeness, \a is an escape character and that is causing issue for you. Using raw string as mentioned in the comments solve this issue.
You can see this clearly if you do repr(file_path) . This is one of the gotchas with Windows. I would suggest using forward slashes for accessing files even in Windows to avoid running into these issues.
Can you try below code
df=pd.read_csv('C:\\\\Users\\\\a089673\\\\Desktop\\\\lbcsv\\\\csv\\\\server.csv')
df
Hope it helps !
Answer was to add the 's' at the end of the file name and to use the \ in the file path.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
This is the package which has a webapp demo in it.
However, when I login use this demo, I get an error.
How to make this demo running on the gae-launcher?
Looks like a bug in gaema.
The line that's failing is trying to urlencode a dictionary of arguments that get passed to the OpenID endpoint. One or more of the values, perhaps your first or last name, has non-ASCII characters.
You might be able to work around it by replacing instances of this:
urllib.urlencode(args)
With this:
urllib.urlencode(dict([(k, args[k].encode('utf-8')) for k in args]))
For a more permanent fix, I would report the issue here:
http://code.google.com/p/gaema/issues/list