Getting error while creating scatter plot from basemap object

In step 2 of guided project Analyzing NYC High School Data

As asked i have grouped the dataframe by school_dist:

groupby_dist=combined.groupby(“school_dist”).agg(np.mean) #Grouping the combined by school_dist
groupby_dist.reset_index(“school_dist”) #resetting the index

while creating creating scatter plot from basemap object :
m.scatter(longitudes,latitudes,s=50,latlon=True,c=groupby_dist[“saf_s_11”],cmap=“summer”)

I am getting following error :

ValueErrorTraceback (most recent call last)
/dataquest/system/env/python3/lib/python3.4/site-packages/matplotlib/colors.py in to_rgba(self, arg, alpha)
367 raise ValueError(
–> 368 ‘length of rgba sequence should be either 3 or 4’)
369 else:

ValueError: length of rgba sequence should be either 3 or 4

Hey @padarthi30! This question is sort of confusing - do you mind using the code editor when you include code, the question you’re asking, and a new title that clearly states your issue? The best way to get quick, thorough answers is to ask great questions!

We have a great article you can read here that can help guide you through asking a good question.

2 Likes