making a scatter plot
play

Making a scatter plot IN TR OD U C TION TO DATA SC IE N C E IN P - PowerPoint PPT Presentation

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


  1. 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

  2. Mapping Cell Phone Signals INTRODUCTION TO DATA SCIENCE IN PYTHON

  3. What is a scatter plot ? INTRODUCTION TO DATA SCIENCE IN PYTHON

  4. What is a scatter plot ? INTRODUCTION TO DATA SCIENCE IN PYTHON

  5. 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

  6. Ke yw ord arg u ments plt.scatter(df.age, df.height, color='green', marker='s') INTRODUCTION TO DATA SCIENCE IN PYTHON

  7. Changing marker transparenc y plt.scatter(df.x_data, df.y_data, alpha=0.1) INTRODUCTION TO DATA SCIENCE IN PYTHON

  8. Let ' s practice IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON

  9. 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

  10. 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

  11. Hori z ontal bar charts plt.barh(df.precinct, df.pets_abducted) plt.ylabel('Pet Abductions') plt.show() INTRODUCTION TO DATA SCIENCE IN PYTHON

  12. 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

  13. Stacked bar charts INTRODUCTION TO DATA SCIENCE IN PYTHON

  14. Stacked bar charts INTRODUCTION TO DATA SCIENCE IN PYTHON

  15. Stacked bar charts INTRODUCTION TO DATA SCIENCE IN PYTHON

  16. 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

  17. Let ' s practice IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON

  18. 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

  19. Tracking do w n the kidnapper INTRODUCTION TO DATA SCIENCE IN PYTHON

  20. What is a histogram ? INTRODUCTION TO DATA SCIENCE IN PYTHON

  21. Histograms w ith matplotlib plt.hist(gravel.mass) plt.show() INTRODUCTION TO DATA SCIENCE IN PYTHON

  22. Changing bins plt.hist(data, bins=nbins) plt.hist(gravel.mass, bins=40) INTRODUCTION TO DATA SCIENCE IN PYTHON

  23. Changing range plt.hist(data, range=(xmin, xmax)) plt.hist(gravel.mass, range=(50, 100)) INTRODUCTION TO DATA SCIENCE IN PYTHON

  24. 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

  25. Let ' s practice IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON

  26. 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

  27. Yo u did it ! INTRODUCTION TO DATA SCIENCE IN PYTHON

  28. 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

  29. Using f u nctions Perform a task Positional arg u ments Ke yw ord arg u ments INTRODUCTION TO DATA SCIENCE IN PYTHON

  30. 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

  31. 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

  32. 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

  33. Great job ! IN TR OD U C TION TO DATA SC IE N C E IN P YTH ON

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend