• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 25 páginas
Examen

Data 8 Lab 4 DATA C8|everything you need

Document preview thumbnail
Vista previa 3 fuera de 25 páginas

Functions and Visualizations Welcome to lab 4! This week, we'll learn about functions and the table method apply from Section 8.1 ( about visualization from Chapter 7 ( First, set up the tests and imports by running the cell below. In [1]: import numpy as np from datascience import * # These lines set up graphing capabilities. import matplotlib %matplotlib inline import t as plt ('fivethirtyeight') import warnings efilter('ignore', FutureWarning) from ipywidgets import interact, interactive, fixed, interact_manual import ipywidgets as widgets from ook import Notebook ok = Notebook('') _ = (inline=True) 1. Functions and CEO Incomes Let's start with a real data analysis task. We'll look at the 2015 compensation of CEOs at the 100 largest companies in California. The data were compiled for a Los Angeles Times analysis here ( ( companies have two CEOs, so there are 102 CEOs in the dataset. We've copied the data in raw form from the LA Times page into a file called raw_ . (The page notes that all dollar amounts are in millions of dollars.) ===================================================================== Assignment: Lab 4 OK, version v1.13.9 ===================================================================== Successfully logged in as In [2]: raw_compensation = T_table('raw_') raw_compensation Question 1. We want to compute the average of the CEOs' pay. Try running the cell below. Out[2]: Rank Name Company (Headquarters) Total Pay % Change Cash Pay Equity Pay Other Pay Ratio of CEO pay to average industry worker pay 1 Mark V. Hurd* Oracle (Redwood City) $53.25 (No previous year) $0.95 $52.27 $0.02 362 2 Safra A. Catz* Oracle (Redwood City) $53.24 (No previous year) $0.95 $52.27 $0.02 362 3 Robert A. Iger Walt Disney (Burbank) $44.91 -3% $24.89 $17.28 $2.74 477 4 Marissa A. Mayer Yahoo! (Sunnyvale) $35.98 -15% $1.00 $34.43 $0.55 342 5 Marc Benioff (San Francisco) $33.36 -16% $4.65 $27.26 $1.45 338 6 John H. Hammergren McKesson (San Francisco) $24.84 -4% $12.10 $12.37 $0.37 222 7 John S. Watson Chevron (San Ramon) $22.04 -15% $4.31 $14.68 $3.05 183 8 Jeffrey Weiner LinkedIn (Mountain View) $19.86 27% $2.47 $17.26 $0.13 182 9 John T. Chambers** Cisco Systems (San Jose) $19.62 19% $5.10 $14.51 $0.01 170 10 John G. Stumpf Wells Fargo (San Francisco) $19.32 -10% $6.80 $12.50 $0.02 256 ... (92 rows omitted) In [3]: ge(raw_n("Total Pay")) You should see an error. Let's examine why this error occured by looking at the values in the "Total Pay" column. Use the type function and set total_pay_type to the type of the first value in the "Total Pay" column. In [4]: total_pay_type = type(raw_n("Total Pay").item(0)) #SO LUTION total_pay_type In [5]: _ = ('q1_1') ---------------------------------------------------------------------- ----- TypeError Traceback (most recent call last) ipython-input-3-39b2b017c72a in module() ---- 1 ge(raw_n("Total Pay")) //anaconda/lib/python3.5/site-packages/numpy/lib/function_ in a verage(a, axis, weights, returned) 1108 1109 if weights is None: - 1110 avg = (axis) 1111 scl = ( 1112 else: //anaconda/lib/python3.5/site-packages/numpy/core/_ in _mean (a, axis, dtype, out, keepdims) 68 is_float16_result = True 69 --- 70 ret


Información del documento

Subido en
27 de octubre de 2022
Número de páginas
25
Escrito en
2022/2023
Tipo
Examen
Contiene
Preguntas y respuestas
$9.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Abbyy01
3.5
(13)
Vendido
98
Seguidores
33
Artículos
1332
Última venta
3 meses hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes

Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.