Traverse a dictionary with for loop Accessing keys and values in dictionary. Use Dict.values() and Dict.keys() to generate keys and values as iterable. Nested Dictionaries with for loop Access Nested values of Nested Dictionaries How useful was this post? Click on a star to rate it! Submit Rating
dict={1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten'}dictO/P:{1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten'}for i indict:print(dict[i])O/P:onetwothreefourfivesixseveneightnineten
Accessing keys and values in dictionary.
for i indict:print(i,dict[i])O/P:1 one2 two3 three4 four5 five6 six7 seven8 eight9 nine10 ten
Use Dict.values() and Dict.keys() to generate keys and values as iterable.
for key indict.keys():print(key)O/P:12345678910for value indict.values():print(value)O/P:onetwothreefourfivesixseveneightnineten
Nested Dictionaries with for loop
Access Nested values of Nested Dictionaries
dict={'Apple':{'color':'red','taste':'sweet'},'Lemon':{'color':'yellow','taste':'sour'},'Cherry':{'color':'red','taste':'sweet'},}for i indict:print(i)for j in dict[i]:print(j,dict[i][j])print()O/P:Applecolor redtaste sweetLemoncolor yellowtaste sourCherrycolor redtaste sweet
Seaborn library has matplotlib at its core for data point visualizations. This library gives highly statistical informative graphics functionality to Seaborn.
The Matplotlib library helps you create static and dynamic visualisations. Dynamic visualizations that are animated and interactive. This library makes it easy to plot data and create graphs.
This library is named Plotly after the company of the same name. Plotly provides visualization libraries for Python, R, MATLAB, Perl, Julia, Arduino, and REST.
Pandas is a easy to use data analysis and manipulation tool. Pandas provides functionality for categorical,ordinal, and time series data . Panda provides fast and powerful calculations for data analysis.