Skip to content

Name error #584

Answered by eculler
allenmoench asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @allenmoench, it looks to me like you have a bit of an indentation problem here. Remember that indentation is how Python knows whether something is inside or outside a function -- and also that variables defined inside a function are not available outside! So, in this case, bounds_gdf is being referenced outside the function (it's unindented), but it's only defined at all because it is listed as a function parameter. Outside the function, it's called denver_redlining_gdf.

Same think with da -- you define that variable inside the function, not outside, but the code referencing it is outside.

Good news is, I think your code will work if you indent lines 21-31 one more step!

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by allenmoench
Comment options

allenmoench
Nov 8, 2024
Collaborator Author

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants