How to deal with Dictionary Basics in Python?
DATA MUNGING DATA CLEANING PYTHON MACHINE LEARNING RECIPES PANDAS CHEATSHEET     ALL TAGS

How to deal with Dictionary Basics in Python?

How to deal with Dictionary Basics in Python?

This recipe helps you deal with Dictionary Basics in Python

0

Recipe Objective

Have you tired to change values in dictionary or print some of the values?

So this is the recipe on how we can work with Dictionary Basics in Python.

Step 1 - Creating Dictionary

unef_org = {"name" : "UNEF", "staff" : 32, "url" : "http://unef.org"} print(unef_org)

We have created a dictionary and printed it.

Step 2 - Changing the dictionary

We have changed the values by assining new values to the features. who_org = {} who_org["name"] = "WHO" who_org["staff"] = "10" who_org["url"] = "https://setscholars.com" print(who_org)

Step 3 - Viewing few values

We have created a new dictionary and printed the desired value by passing the index of the value. unitas_org = {"name" : "UNITAS", "staff" : 32, "url" : ["https://setscholars.com", "https://setscholars.info"]} print(unitas_org) print(unitas_org["url"]) print(unitas_org["url"][0]) print(unitas_org["url"][1]) So the output comes as

{"name": "UNEF", "staff": 32, "url": "http://unef.org"}

{"name": "WHO", "staff": "10", "url": "https://setscholars.com"}

{"name": "UNITAS", "staff": 32, "url": ["https://setscholars.com", "https://setscholars.info"]}

["https://setscholars.com", "https://setscholars.info"]

https://setscholars.com

https://setscholars.info

Relevant Projects

Census Income Data Set Project - Predict Adult Census Income
Use the Adult Income dataset to predict whether income exceeds 50K yr based on census data.

Topic modelling using Kmeans clustering to group customer reviews
In this Kmeans clustering machine learning project, you will perform topic modelling in order to group customer reviews based on recurring patterns.

PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

Sequence Classification with LSTM RNN in Python with Keras
In this project, we are going to work on Sequence to Sequence Prediction using IMDB Movie Review Dataset​ using Keras in Python.

Ensemble Machine Learning Project - All State Insurance Claims Severity Prediction
In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

Perform Time series modelling using Facebook Prophet
In this project, we are going to talk about Time Series Forecasting to predict the electricity requirement for a particular house using Prophet.

Solving Multiple Classification use cases Using H2O
In this project, we are going to talk about H2O and functionality in terms of building Machine Learning models.

Walmart Sales Forecasting Data Science Project
Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.

Music Recommendation System Project using Python and R
Machine Learning Project - Work with KKBOX's Music Recommendation System dataset to build the best music recommendation engine.

Mercari Price Suggestion Challenge Data Science Project
Data Science Project in Python- Build a machine learning algorithm that automatically suggests the right product prices.