DS201_Lab8_rachelspence.ipynb - Colaboratory

pdf

School

Iowa State University *

*We aren’t endorsed by this school

Course

201

Subject

Statistics

Date

Jan 9, 2024

Type

pdf

Pages

4

Uploaded by GrandResolvePanther40

Report
11/2/22, 4:14 PM DS201_Lab8_rachelspence.ipynb - Colaboratory https://colab.research.google.com/drive/1F2M3ItuuNCgdRXWCS_gYq8cNn2mvoPPJ#scrollTo=dpS-EBP3_fgR&printMode=true 1/4 import numpy as np import pandas as pd lemon = pd.read_csv(' /content/Lemonade_Lab8.csv') lemon.head <bound method NDFrame.head of Date Location Lemon Orange Temperature Leaflets Price 0 7/1/16 Park 97 78 70 90 0.25 1 7/2/16 Park 98 67 72 90 0.25 2 7/3/16 Park 110 54 71 104 0.25 3 7/4/16 Beach 134 56 76 98 0.25 4 7/5/16 Beach 159 90 78 135 0.25 .. ... ... ... ... ... ... ... 58 8/27/16 Park 129 100 83 90 0.35 59 8/28/16 Park 68 56 80 104 0.35 60 8/29/16 Park 63 77 82 98 0.35 61 8/30/16 Park 66 90 81 135 0.35 62 8/31/16 Beach 57 65 82 90 0.35 [63 rows x 7 columns]> Date Location Lemon Orange Temperature Leaflets Price 0 False False False False False False False 1 False False False False False False False 2 False False False False False False False 3 False False False False False False False 4 False False False False False False False ... ... ... ... ... ... ... ... 58 False False False False False False False 59 False False False False False False False 60 False False False False False False False 61 False False False False False False False 62 False False False False False False False 63 rows × 7 columns lemon.isnull() lemon.duplicated()
11/2/22, 4:14 PM DS201_Lab8_rachelspence.ipynb - Colaboratory https://colab.research.google.com/drive/1F2M3ItuuNCgdRXWCS_gYq8cNn2mvoPPJ#scrollTo=dpS-EBP3_fgR&printMode=true 2/4 0 False 1 False 2 False 3 False 4 False ... 58 False 59 False 60 False 61 False 62 False Length: 63, dtype: bool from bokeh.models import ColumnDataSource source_Q4 = ColumnDataSource(lemon) from bokeh.io import output_notebook, show output_notebook() from bokeh.plotting import figure p1 = figure(title= 'Lemon and Orange Sales by Temperature') p1.circle('Temperature','Lemon', source= source_Q4, color='green', size=8, legend= dic p1.triangle('Temperature','Orange', source= source_Q4, color='orange', size=8, legend= p1.legend.location= 'top_left' show(p1)
11/2/22, 4:14 PM DS201_Lab8_rachelspence.ipynb - Colaboratory https://colab.research.google.com/drive/1F2M3ItuuNCgdRXWCS_gYq8cNn2mvoPPJ#scrollTo=dpS-EBP3_fgR&printMode=true 3/4 You can see there is an increase in the number of oranges and lemons as the tempature increases. There is more plotted symbols on the right side of the graph. avg = lemon.groupby('Temperature')['Lemon'].mean() std = lemon.groupby('Temperature')['Lemon'].std() temperatures = list(lemon.groupby('Temperature').groups) from bokeh.models import ColumnDataSource, CDSView, GroupFilter source_Q6 = ColumnDataSource(lemon) park = CDSView(source=source_Q6, filters=[GroupFilter(column_name='Location beach = CDSView(source=source_Q6, filters=[GroupFilter(column_name='Locatio p2 = figure(title='Temperature Vs Lemon Sales (Beach and Park)') p2.circle('Temperature', 'Lemon', source=source_Q6, color='red', size=8, vi p2.triangle('Temperature', 'Lemon', source=source_Q6, color='blue', size=8, p2.vbar(x=temperatures, top=avg+std, width=0.8, bottom=avg-std, fill_alpha= p2.legend.location = 'top_left' show(p2)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
11/2/22, 4:14 PM DS201_Lab8_rachelspence.ipynb - Colaboratory https://colab.research.google.com/drive/1F2M3ItuuNCgdRXWCS_gYq8cNn2mvoPPJ#scrollTo=dpS-EBP3_fgR&printMode=true 4/4 0s completed at 3:54 PM Colab paid products - Cancel contracts here From this ±gure I can infer that no one id going to the beaach when the weather is below 74 degrees. I can also infer that more lemons and organges are bought when the temperature is warmer outside. When it is hot outside there is an equal about of people buying at the park and the beach.