Making a scatter plot IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON Hillar y Green - Lerman Lead Data Scientist , Looker
Mapping Cell Phone Signals INTRODUCTION TO DATA SCIENCE IN PYTHON
What is a scatter plot ? INTRODUCTION TO DATA SCIENCE IN PYTHON
What is a scatter plot ? INTRODUCTION TO DATA SCIENCE IN PYTHON
Creating a scatter plot plt.scatter(df.age, df.height) plt.xlabel('Age (in months)') plt.ylabel('Height (in inches)') plt.show() INTRODUCTION TO DATA SCIENCE IN PYTHON
Ke yw ord arg u ments plt.scatter(df.age, df.height, color='green', marker='s') INTRODUCTION TO DATA SCIENCE IN PYTHON
Changing marker transparenc y plt.scatter(df.x_data, df.y_data, alpha=0.1) INTRODUCTION TO DATA SCIENCE IN PYTHON
Let ' s practice IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON
Making a bar chart IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON Hillar y Green - Lerman Lead Data Scientist , Looker
Comparing pet crimes plt.bar(df.precinct, precinct pets _ abd u cted df.pets_abducted) Farmb u rg 10 plt.ylabel('Pet Abductions') plt.show() Cit yv ille 15 S u b u rbia 9 INTRODUCTION TO DATA SCIENCE IN PYTHON
Hori z ontal bar charts plt.barh(df.precinct, df.pets_abducted) plt.ylabel('Pet Abductions') plt.show() INTRODUCTION TO DATA SCIENCE IN PYTHON
Adding error bars plt.bar(df.precinct, df.pet_abductions, yerr=df.error) plt.ylabel('Pet Abductions') plt.show() INTRODUCTION TO DATA SCIENCE IN PYTHON
Stacked bar charts INTRODUCTION TO DATA SCIENCE IN PYTHON
Stacked bar charts INTRODUCTION TO DATA SCIENCE IN PYTHON
Stacked bar charts INTRODUCTION TO DATA SCIENCE IN PYTHON
Stacked bar charts plt.bar(df.precinct, df.dog, label='Dog') plt.bar(df.precinct, df.cat, bottom=df.dog, label='Cat') plt.legend() plt.show() INTRODUCTION TO DATA SCIENCE IN PYTHON
Let ' s practice IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON
Making a histogram IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON Hillar y Green - Lerman Lead Data Scientist , Looker
Tracking do w n the kidnapper INTRODUCTION TO DATA SCIENCE IN PYTHON
What is a histogram ? INTRODUCTION TO DATA SCIENCE IN PYTHON
Histograms w ith matplotlib plt.hist(gravel.mass) plt.show() INTRODUCTION TO DATA SCIENCE IN PYTHON
Changing bins plt.hist(data, bins=nbins) plt.hist(gravel.mass, bins=40) INTRODUCTION TO DATA SCIENCE IN PYTHON
Changing range plt.hist(data, range=(xmin, xmax)) plt.hist(gravel.mass, range=(50, 100)) INTRODUCTION TO DATA SCIENCE IN PYTHON
Normali z ing Unnormali z ed bar plot S u m of bar area = 1 plt.hist(male_weight) plt.hist(male_weight, density=True) plt.hist(female_weight) plt.hist(female_weight, density=True) INTRODUCTION TO DATA SCIENCE IN PYTHON
Let ' s practice IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON
Recap of the resc u e IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON Hillar y Green - Lerman Lead Data Scientist , Looker
Yo u did it ! INTRODUCTION TO DATA SCIENCE IN PYTHON
Mod u les and v ariables import pandas as pd Mod u les gro u p f u nctions import numpy as np together Add a mod u le u sing import import happens at the beginning of a script � le Variables store data : strings or � oats INTRODUCTION TO DATA SCIENCE IN PYTHON
Using f u nctions Perform a task Positional arg u ments Ke yw ord arg u ments INTRODUCTION TO DATA SCIENCE IN PYTHON
Working w ith tab u lar data import pandas as pd DataFrames store tab u lar data Inspect data u sing .head() or .info() Select ro w s u sing logic credit_reports[ credit_report.suspect == 'Freddy Frequentist'] INTRODUCTION TO DATA SCIENCE IN PYTHON
Creating line plots from matplotlib import pyplot as plt Use plt.plot() to create a line plot Modif y line plots w ith ke yw ord arg u ments Add labels and legends INTRODUCTION TO DATA SCIENCE IN PYTHON
More plot t y pes plt.scatter() sho w s indi v id u al data points plt.bar() creates bar charts plt.hist() v is u ali z es distrib u tions INTRODUCTION TO DATA SCIENCE IN PYTHON
Great job ! IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON
Recommend
More recommend