Skip to content

Commit 4767cfd

Browse files
authored
Update interactive_weather_plot.py
I am using Python 3.11.3 I was having this error : "TypeError: 'dict_keys' object is not subscriptable" locations.keys() had to be explicitly converted into list to prevent this exception.
1 parent d6ba5d6 commit 4767cfd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

general/interactive-weather-plot/interactive_weather_plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def changeLocation(newLocation):
6868
# Making the Radio Buttons
6969
buttons = RadioButtons(
7070
ax=plt.axes([0.1, 0.1, 0.2, 0.2]),
71-
labels=locations.keys()
71+
labels=list(locations.keys())
7272
)
7373

7474
# Connect click event on the buttons to the function that changes location.
@@ -86,4 +86,4 @@ def changeLocation(newLocation):
8686

8787
plt.savefig('file.svg', format='svg')
8888

89-
plt.show()
89+
plt.show()

0 commit comments

Comments
 (0)