give me this data as key value pairs genres =…
- User
give me this data as key value pairs
genres = ["Thriller","Action","Drama","Crime","Documentary","Adventure","History","SciFI","RealityTv","Newa","TalkSHow"] no_of_shows = [thrillercount,actioncount,dramacount,crimecount,documentarycount,adventurecount,historycount,scificount,realitytvcount,newscount,talkshowcount]like this data = {'C': 20, 'C++': 15, 'Java': 30, 'Python': 35}
- Assistant
Certainly! Given two lists
genresandno_of_shows, you want to combine them into a dictionary where the genres are the keys and the corresponding number of shows are the values.Assuming that the variable names for the counts (like
thrillercount,actioncount, etc.) have already been defined and hold the relevant numbers for each genre, you can use Python'szipfunction to create the key-value pairs and then turn that into a dictionary.Here's the resulting dictionary based on the provided information:
python - User
Traceback (most recent call last): File "/Users/3963829/PycharmProjects/pythonProject2/main.py", line 85, in plt.bar(courses, values, color='maroon', File "/Users/3963829/PycharmProjects/pythonProject2/venv/lib/python3.9/site-packages/matplotlib/pyplot.py", line 2754, in bar return gca().bar( File "/Users/3963829/PycharmProjects/pythonProject2/venv/lib/python3.9/site-packages/matplotlib/init.py", line 1465, in inner return func(ax, *map(sanitize_sequence, args), **kwargs) File "/Users/3963829/PycharmProjects/pythonProject2/venv/lib/python3.9/site-packages/matplotlib/axes/_axes.py", line 2523, in bar r = mpatches.Rectangle( File "/Users/3963829/PycharmProjects/pythonProject2/venv/lib/python3.9/site-packages/matplotlib/patches.py", line 718, in init super().init(**kwargs) File "/Users/3963829/PycharmProjects/pythonProject2/venv/lib/python3.9/site-packages/matplotlib/patches.py", line 91, in init self.set_linewidth(linewidth) File "/Users/3963829/PycharmProjects/pythonProject2/venv/lib/python3.9/site-packages/matplotlib/patches.py", line 391, in set_linewidth self._linewidth = float(w) TypeError: only length-1 arrays can be converted to Python scalars
- Assistant
The error message indicates that there is an issue with the
linewidthargument passed to a MatplotlibRectangleobject (which Bar plots use internally). It suggests that a non-scalar value (an array-like or possibly an incorrect type) is supplied where a single float number (a scalar value) is expected.To proceed with debugging:
-
Check if you have explicitly set the
linewidthargument in the call or any related configuration that affects the appearance of the bars. Ensure that it is a single numeric value.
-