Why are my variables highlighted in blue? [closed] - python

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 2 years ago.
Improve this question
I have a dataframe called propertydf.
When I run my code I get a very vague error:
propertydf = propertydf[propertydf['fixed_price'].notna()].copy()
^
SyntaxError: invalid syntax
I checked the code and the dataframe variable has changed color to blue? But not all of them.
I also noticed some other variables are suddenly blue, such as year and date.
I think this is causing the error. How can I fix it?

In the line propertydf['fixed_price'] = fix_price((propertydf.iloc[:,[4]]) you open two parenthesis but only close one (It's above the line that throws the error).

Related

Can someone please explain how to do this [closed]

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 2 days ago.
Improve this question
The following code must be updated to the full file path on your computer. The ‘r’ must proceed the file name so backslash characters are not interpreted as escape characters.
here is what i am trying to put in:
poke = pd.read_csv(r'DriveLetter\full path\Pokemon.csv')
type(poke)
This is what its telling me:

i can't seem to understand what is causing the error [closed]

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 1 year ago.
Improve this question
File "<ipython-input-193-4fdf3d1abd17>", line 1
ConfusionMatrix(y_data, model.predict(y_data() , label= ["not_subscribed", "subscribed"])
^
SyntaxError: unexpected EOF while parsing
You're missing an extra bracket, observe you have an EOF error. Try this
ConfusionMatrix(y_data, model.predict(y_data() , label= ["not_subscribed", "subscribed"]))
The python compiler is pretty friendly, as you can see where the error arrow is pointing to, most of time :)

What does "\" mean in the following code? [closed]

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 1 year ago.
Improve this question
I encountered this code while studying String Formatting Operators in Python:
print('%(language)s has %(number)03d quote types.'%\
{"language":"Python", "number":2})
What does "\" represent in this code?
As you can read in Python's documentation a back slash breaks the line of code allowing for the next line continuation.

Codeacademy - SyntaxError: 'return' outside function [closed]

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 2 years ago.
Improve this question
I'm not sure why I'm getting this error.enter image description here
You only need a return statement if you are inside a function. The syntax of a function is the following:
def functionName():
# code goes here
return # you can also specify what to return here or just leave it
# blank, a return statement is not necessary.

I can't determine why it's raising this SyntaxError [closed]

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 3 years ago.
Improve this question
https://pastebin.com/TZdMx3pM
Here's the code
This error is raised on line 291:
File "marketTrader.py", line 291
stock_list.remove(preferredStock[0])
^
SyntaxError: invalid syntax
I am runing on MacOS. Does it matter if I'm using Python 2 or 3?
Any help is greatly appreciated!
You forgot to close a parentheses on the previous line, 290.
This kind of syntax error does not depend on Python version or OS.
You could have spotted it easily using an IDE (e.g. PyCharm, EMACS) or a static analyser (e.g. pycheck).
It's a missing ')'
Check the line before:
print(': Starting Active Trader with preferred stock {}...'.format([preferredStock[0]])
stock_list.remove(preferredStock[0])
There is missing a close bracket for print.

Categories

Resources