I keep getting an error that says
AttributeError: 'NoneType' object has no attribute 'something'
The code I have is too long to post here. What general scenarios would cause this AttributeError, what is NoneType supposed to mean and how can I narrow do...
Is there a good practice for entering NULL key values to a PostgreSQL database when a variable is None in Python?
Running this query:
mycursor.execute('INSERT INTO products (user_id, city_id, product_id, quantity, price) VALUES (%i, %i, %i, %i, %f)' %(u...
What does error TypeError: 'NoneType' object is not iterable mean?
I am getting it on this Python code:
def write_file(data, filename): # creates file and writes list to it
with open(filename, 'wb') as outfile:
writer = csv.writer(outfile)
from flask import Flask, render_template, request
from sys import argv
app = Flask(__name__)
for w in [words] + [words[:-x] for x in range(1,len(words))]:
url = 'http://ws.spotify.com/sea...
I have an array that looks like:
k = numpy.array([(1.,0.001), (1.1, 0.002), (None, None),
(1.2, 0.003), (0.99, 0.004)])
I want to plot the values that are not (None, None) and keep the index of the array value. That is, I want a gap w...
This was my source I started with.
L = [0, 23, 234, 89, None, 0, 35, 9]
When I run this :
L = filter(None, L)
I get this results
[23, 234, 89, 35, 9]
But this is not what I need, what I really need is :
[0, 23, 234, 89, 0, 35, 9]
I need a way to get a dictionary value if its key exists, or simply return None, if it does not.
However, Python raises a KeyError exception if you search for a key that does not exist. I know that I can check for the key, but I am looking for something ...
I'm getting this error when I run my python script:
TypeError: cannot concatenate 'str' and 'NoneType' objects
I'm pretty sure the 'str' means string, but I dont know what a 'NoneType' object is. My script craps out on the second line, I know the first...
I have a method that sometimes returns a NoneType value. So how can I question a variable that is a NoneType? I need to use if method, for example
if not new:
new = '#'
I know that is the wrong way and I hope you understand what I meant.
How do I compare a pandas DataFrame with None? I have a constructor that takes one of a parameter_file or a pandas_df but never both.