welcome to p y thon
play

Welcome to P y thon ! P YTH ON FOR SP R E AD SH E E T U SE R S - PowerPoint PPT Presentation

Welcome to P y thon ! P YTH ON FOR SP R E AD SH E E T U SE R S Chris Cardillo Data Scientist What is P y thon ? General p u rpose programming lang u age Has code packages for data science Object - oriented PYTHON FOR SPREADSHEET USERS Object


  1. Welcome to P y thon ! P YTH ON FOR SP R E AD SH E E T U SE R S Chris Cardillo Data Scientist

  2. What is P y thon ? General p u rpose programming lang u age Has code packages for data science Object - oriented PYTHON FOR SPREADSHEET USERS

  3. Object - oriented spreadsheets PYTHON FOR SPREADSHEET USERS

  4. Object - oriented spreadsheets PYTHON FOR SPREADSHEET USERS

  5. Object - oriented P y thon In P y thon In Spreadsheets math.SUM(2,3) PYTHON FOR SPREADSHEET USERS

  6. The po w er of the dot math is o u r package math.SUM() SUM is o u r f u nction in the package The dot ( . ) lets u s access the f u nction inside the package PYTHON FOR SPREADSHEET USERS

  7. Scripts A Recipe for B u � ered Toast 1. Turn on toaster 2. Put bread in toaster for 1 minute 3. Take bread out of toaster 4. Put butter on toast PYTHON FOR SPREADSHEET USERS

  8. Importing packages import math PYTHON FOR SPREADSHEET USERS

  9. Importing pandas PYTHON FOR SPREADSHEET USERS

  10. Importing pandas import pandas PYTHON FOR SPREADSHEET USERS

  11. Loading E x cel data import pandas pandas.read_excel('fruit.xlsx') fr u it .x ls x ( the kind of data pandas likes ) PYTHON FOR SPREADSHEET USERS

  12. pandas as pd before a � er import pandas import pandas as pd pandas.read_excel('fruit.xlsx') pd.read_excel('fruit.xlsx') PYTHON FOR SPREADSHEET USERS

  13. Variable assignment import pandas as pd fruit = pd.read_excel('fruit.xlsx') fr u it .x ls x PYTHON FOR SPREADSHEET USERS

  14. Looking at data w ith print () import pandas as pd fruit = pd.read_excel('fruit.xlsx') print(fruit) PYTHON FOR SPREADSHEET USERS

  15. Script and console panes in DataCamp SCRIPT.PY is the script IPYTHON SHELL is the console PYTHON FOR SPREADSHEET USERS

  16. Yo u r t u rn ! P YTH ON FOR SP R E AD SH E E T U SE R S

  17. DataFrames and their methods P YTH ON FOR SP R E AD SH E E T U SE R S Chris Cardillo Data Scientist

  18. Where w e left off import pandas as pd fruit = pd.read_excel('fruit.xlsx') print(fruit) PYTHON FOR SPREADSHEET USERS

  19. Anatom y of a pandas DataFrame PYTHON FOR SPREADSHEET USERS

  20. Anatom y of a pandas DataFrame PYTHON FOR SPREADSHEET USERS

  21. Anatom y of a pandas DataFrame PYTHON FOR SPREADSHEET USERS

  22. Anatom y of a pandas DataFrame PYTHON FOR SPREADSHEET USERS

  23. Anatom y of a pandas DataFrame PYTHON FOR SPREADSHEET USERS

  24. Anatom y of a pandas DataFrame PYTHON FOR SPREADSHEET USERS

  25. Anatom y of a pandas DataFrame PYTHON FOR SPREADSHEET USERS

  26. DataFrame methods .head() .info() .describe() .sort_values() PYTHON FOR SPREADSHEET USERS

  27. The . head () method import pandas as pd fruit = pd.read_excel('fruit.xlsx') print(fruit.head()) PYTHON FOR SPREADSHEET USERS

  28. The . head () method import pandas as pd fruit = pd.read_excel('fruit.xlsx') print(fruit.head(2)) PYTHON FOR SPREADSHEET USERS

  29. The . info () method import pandas as pd fruit = pd.read_excel('fruit.xlsx') print(fruit.info()) PYTHON FOR SPREADSHEET USERS

  30. The . describe () method import pandas as pd fruit = pd.read_excel('fruit.xlsx') print(fruit.describe()) PYTHON FOR SPREADSHEET USERS

  31. The . sort _v al u es () method import pandas as pd fruit = pd.read_excel('fruit.xlsx') fruit = fruit.sort_values('name') fruit = fruit.reset_index(drop=True) print(fruit) PYTHON FOR SPREADSHEET USERS

  32. The . sort _v al u es () method import pandas as pd fruit = pd.read_excel('fruit.xlsx') fruit = fruit.sort_values('price_usd', ascending=False) fruit = fruit.reset_index(drop=True) print(fruit.head(3)) PYTHON FOR SPREADSHEET USERS

  33. Yo u r t u rn ! P YTH ON FOR SP R E AD SH E E T U SE R S

  34. Filtering ro w s and creating col u mns P YTH ON FOR SP R E AD SH E E T U SE R S Chris Cardillo Data Scientist

  35. Filtering in spreadsheets PYTHON FOR SPREADSHEET USERS

  36. Accessing a single col u mn PYTHON FOR SPREADSHEET USERS

  37. Accessing a single col u mn fruit['name'] PYTHON FOR SPREADSHEET USERS

  38. Comparison operators == ( eq u al to ) != ( not eq u al to ) < ( less than ) > ( greater than ) <= ( less than or eq u al to ) >= ( greater or eq u al to ) PYTHON FOR SPREADSHEET USERS

  39. Comparisons fruit['name'] fruit['name'] == "Apple" PYTHON FOR SPREADSHEET USERS

  40. Filtering fruit[fruit['name'] == "Apple"] PYTHON FOR SPREADSHEET USERS

  41. Filtering fruit[fruit['price_usd'] > 1] PYTHON FOR SPREADSHEET USERS

  42. Filtering fruit[fruit['price_usd'] > 1].reset_index(drop=True) PYTHON FOR SPREADSHEET USERS

  43. Basic filtering pattern df[df['this_column'] == 'that value'] PYTHON FOR SPREADSHEET USERS

  44. Basic filtering pattern In P y thon In Spreadsheets fruit[fruit['name'] == "Apple"] PYTHON FOR SPREADSHEET USERS

  45. Creating a ne w col u mn PYTHON FOR SPREADSHEET USERS

  46. Creating a ne w col u mn PYTHON FOR SPREADSHEET USERS

  47. Mathematical operators + ( addition ) - ( s u btraction ) * ( m u ltiplication ) / ( di v ision ) PYTHON FOR SPREADSHEET USERS

  48. Creating a ne w col u mn fruit['cost'] = fruit['price_usd'] * 2 PYTHON FOR SPREADSHEET USERS

  49. Creating a ne w col u mn PYTHON FOR SPREADSHEET USERS

  50. Creating a ne w col u mn PYTHON FOR SPREADSHEET USERS

  51. Creating a ne w col u mn fruit['cost'] = fruit['price_usd'] * fruit['quantity'] PYTHON FOR SPREADSHEET USERS

  52. Yo u r t u rn ! P YTH ON FOR SP R E AD SH E E T U SE R S

Recommend


More recommend