Durga Pokharel

Posted on

# Day 73 Of 100DaysOfCode: Data Visualization

This is my 73th day of #100daysofcode and #python learning. Today, I keep learning from Datacamp and also completed some assignments. Also, I am present in one bootcamp from dphi where I did data visualization on data given on assignment, which contained some metropolitan data and publicly available here.

After I got Hawkins Fellowship, I am learning from Datacamp because I have access to most courses there now. Hence my journey of learning Algorithms from Coursera is in pending state. I am going to write some of assignments I completed today.

# dphi Assignment

All the assignments were quizz but I had to write code in order to find the right answer and it was quite fun to try.

I started by reading CSV file using Pandas.

import pandas as pd
%matplotlib inline
data = pd.read_csv("https://raw.githubusercontent.com/dphi-official/Assignment_Solutions/master/Standard%20Metropolitan%20Areas%20Data%20-%20train_data%20-%20data.csv")
data.head()

## Question 1: What is the Mean area of lands?

Not that hard, just take mean.

data.land_area.mean()

Output of the code is,

2615.7272727272725

## Question 2: What is the crime rate among all Metropolitan Areas?

Again it is the max value of single column.

data.crime_rate.max()

Output of the code is,

85.62

## Question 3: What is the average crime rate among all metropolitan areas?

Same as previous, find mean of single column.

data.crime_rate.mean()

Output of the above code is,

55.64303030303031

## Question 4: What is the top 5 data of region 4?

Just do boolean masking.

data[data.region==4]

## More

I have uploaded a fully loaded notebook here

Day 73 Of #100DaysOfCode and #Python
Data Visualization#100DaysOfCode #WomenWhoCode #CodeNewbies #beginner #DEVCommunity pic.twitter.com/RF3dNCgAkm

â€” Durga Pokharel (@mathdurga) March 11, 2021