Data 8R Summer 2017

Data Types and Arrays Discussion 4: July 6, 2017

The squirrels of UC Berkeley have decided to have a faceoff with the squirrels at Stanford. Its up to you to make sure that our squirrels are prepared with the most important knowledge before they head out!

1

A Test of Skill

Before they allow you to help them, the squirrels want to make sure that you’re up for the task. Answer their questions to pass their inspection! 1.1

Ints, Floats, and Strings Impress the squirrels with your knowledge of data types! Print the outputs (or errors) of the following lines of Python code! >>> 6 / 3

>>> round(2 / 3, 2)

>>> "42".replace("4", "ans").replace("2", "wer").upper()

>>> "Doggo" + "Squirrel"

>>> 1337 + "Squirrel"

2

1.2

Data Types and Arrays

Diagram review The squirrels want you to diagram the following expression. Show them what you got! >>> add(15, sub(mul(round(5), 3), 2))

1.3

To be, or None to be As a final question, the squirrels want you to prove you know the difference between prints and outputs. Show them your skills! >>> x = "Wassup?" >>> print(x) >>> x

2 2.1

Organize the data!

Make some arrays! The squirrels have a bunch of data about some neutral squirrels in the Bay Area. Firstly, they want you to put all the data about distance to UC Berkeley in an array assigned to dst to berk. Then, they want to you to put all the data about cleverness score in an array assigned to cleverness.

Write down the code to conduct this request!

Data Types and Arrays

2.2

3

Arraying the Forces Now the Squirrels want you to put data about the various populations into a collective array. Put the population of Berkeley squirrels, Stanford squirrels, and neutral squirrels into an array, in that order. Assign the array to the variable forces.

Write down the code to make such an array!

2.3

Indexing into the Array Now the squirrels want to know the smallest absolute difference in population between the three groups. Index into the forces array that you just made to find the smallest difference between the squirrel populations of Berkeley, Stanford, and the neutrals. Remember, we can index into an array by using the method .item: >>> forces.item(0) ... 20

Fill in the missing code:

>>> min(_________________________, _________________________, _________________________)

4

3 3.1

Data Types and Arrays

Visualizing the Forces

Population Bar Chart! The Squirrels have a difficult task for you: create a bar chart from the population data. Luckily, they’ve supplied a function named bar(labelArray, dataArray) to do the graphing. The bar function takes in two inputs: a labelArray, which contains the names of the bars in the chart, and a dataArray, which contains the value of each label to be charted. You will have to create the label array (which should consist of the values Berkeley, Stanford, and Neutral). Use the forces array that you’ve already created to supply the data. Remember that the values should match up - we want the values in the data array to correspond with the correct locations. The final graph is displayed below. Write your code here!

Data Types and Arrays

3.2

5

Scatter the Cleverness Data Now the squirrels want you to create a scatter plot of the cleverness data. Luckily, they’ve created a function called scatter(xArray, yArray), that will create the scatter plot for you. Use the arrays that you’ve created from before to create the scatter plot, using the distance to berkeley data as the x, and the cleverness score data as the y. The final graph is displayed below. Write your code here!

6

4 4.1

Data Types and Arrays

Data Manipulation

Calculations: Calculations Calculations The squirrels now want you to calculate a couple of values for them. Fill in the code you would use beneath each value. Remember to use array methods! The product of all the values in the dst to berk array >>> dstProd = __________

The product of all cleverness score values: >>> cleverProd = __________

The length of both arrays: >>> dstLen = __________ >>> cleverLen = __________

Now the squirrels want you to invert the lengths (Hint: To invert a number, use 1 number >>> dstLenInverted = __________ >>> cleverLenInverted = __________

The squirrels want you to calculate the value of the products to the power of the lengths inverted: >>> finalValueDist = __________ >>> finalValueClever = __________

Note: Those tricky squirrels got you to calculate the geometric mean, which is another measure of ”the center” of some data.

Data 8R Data Types and Arrays Summer 2017 1 A Test of Skill - GitHub

1 A Test of Skill ... errors) of the following lines of Python code! >>> 6 / 3 ... Luckily, they've supplied a function named bar(labelArray, dataArray) to do.

141KB Sizes 1 Downloads 327 Views

Recommend Documents

Data 8R Data Types and Arrays Summer 2017 1 A Test of Skill - GitHub
Data 8R. Data Types and Arrays. Summer 2017. Discussion 4: July 6, 2017 ... Impress the squirrels with your knowledge of data types! .... 4 Data Manipulation.

Data 8R Table Methods and Functions Summer 2017 1 ... - GitHub
Jul 18, 2017 - We have the dataset trips, which contains data on trips taken as part ofa ... def num_long_trips(cutoff): ... We want to see what the distribution of.

Data 8R Table Methods and Functions Summer 2017 1 ... - GitHub
Jul 18, 2017 - Data 8R. Table Methods and Functions. Summer 2017. Discussion 7: ... its range - the difference between the highest value in the array and.

Data 8R Tables and more Visualizations Summer 2017 1 ... - GitHub
Jul 11, 2017 - At the same time, the researcher also records the number of ... A business has graphed the proportion of outputs in each year as a bar chart.

Data 8R Tables and more Visualizations Summer 2017 1 ... - GitHub
number of colds each volunteer gets. Is this an observational ... questions about it. A business has graphed the proportion of outputs in each year as a bar chart.

Data 8R Plotting Functions Summer 2017 1 Midterm Review ... - GitHub
Data 8R. Plotting Functions. Summer 2017. Discussion 7: July 20, 2017. 1 Midterm Review. Question 4 ... function onto the table: Hint: Velocity = distance / time.

Data 8R Plotting Functions Summer 2017 1 Midterm Review ... - GitHub
Jul 20, 2017 - In physics calculations, we often want to have the data in terms of centimeters. Create a table called cm table that has the original data and a ...

Data 8R Hypothesis Testing Summer 2017 1 Terminology 2 ... - GitHub
Jul 27, 2017 - simulated on a computer. ... From the histogram, it looks like the higher mean from gambling was not at all that unusual - it certainly could have.

Data 8R Review of Table Methods Summer 2017 - GitHub
Jul 18, 2017 - We find that most trips have smaller length, but a few are very long. We want to see what the distribution of commute lengths looks like, and ...

Data 8R Review of Table Methods Summer 2017 - GitHub
Jul 18, 2017 - We also figure that commuters will be subscribers to the program, not one-time users. ... return np.mean(short_commute.column( Duration ) ...

Data 8R Intro to Visualizations Summer 2017 1 Similarity and ... - GitHub
Jun 27, 2017 - The chips that are present in your computer contain electrical components called transistors. ... Here's another attempt to improve the plot:.

Data 8R Intro to Python Summer 2017 1 Express Yourself! 2 ... - GitHub
Mike had a tremendous growth spurt over the past year. Find his growth rate over this 1 year. (Hint: The Growth Rate is the absolute difference between the final.

Data 8R Intro to Python Summer 2017 1 Express Yourself! 2 ... - GitHub
An expression describes to the computer how to combine pieces of data. ... inputs to a call expression are expressions themselves, you can have another call ...

Different types of data, data quality, available open ...
1. Have data. 2. Magic (?). 3. Something interesting shows up. 4. Profit! “Any sufficiently advanced technology is indistinguishable from magic.” - Arthur C. Clarke ... Types of data. • Structured (databases) vs unstructured (text, image, video

Different types of data, data quality, available open ...
processing tools ... data: Europeana, Digital Public Library of America & The European ... Influential national libraries moving to co-operative open (linked) data.

Performance Considerations of Data Types - SQL Fool
May 13, 2009 - Selecting inappropriate data types, especially on large tables with millions or billions of ... Fortune 500 company I've worked with learned this the hard way. .... This also resulted in smaller indexes, saving over 100GB of disk.

On Understanding Types, Data Abstraction, and ... - CiteSeerX
To answer this question we look at how types arise in several domains of ... Types arise informally in any domain to categorize objects according to their usage ...

1 Visibility Data & AIPS++ Measurement Sets - GitHub
you screw up, restore it with: $ cd ~/Workshop2007 ... cp -a (/net/birch)/data/oms/Workshop2007/demo.MS . ... thus, “skeleton”: we ignore the data in the MS.

HW 2: Chapter 1. Data Exploration - GitHub
OI 1.8: Smoking habits of UK Residents: A survey was conducted to study the smoking habits ... create the scatterplot here. You can use ... Go to the Spurious Correlations website: http://tylervigen.com/discover and use the drop down menu to.

Innovative Projects Summer 2017 - GitHub
Jan 31, 2017 - 10. Page 2 http://nokiawroclaw.pl/ https://github.com/nokia-wroclaw/ .... Develop a tool that will notify person via android app that some system ...

Introduction to NumPy arrays - GitHub
we want our code to run fast. ▷ we want support for linear algebra ... 7. 8 a[0:5] a[5:8]. ▷ if step=1. ▷ slice contains the elements start to stop-1 .... Indexing and slicing in higher dimensions. 0. 8. 16. 24. 32. 1. 9. 17. 25. 33. 2. 10. 18.

Javascript Data Exploration - GitHub
Apr 20, 2016 - Designers. I'm a sort of. « social data scientist ». Paris. Sciences Po médialab. I just received a CSV. Let me grab my laptop ... Page 9 ...

Tabloid data set - GitHub
The Predictive Analytics team builds a model for the probability the customer responds given ... 3 Summary statistics .... Predictions are stored for later analysis.

My precious data - GitHub
Open Science Course 2016 ... It's part of my contribution to science community ... Exports several formats (pdf, docx, csv, text, json, html, xml) ... http://dataverse.org/blog/scientific-data-now-recommends-harvard-dataverse-all-areas-s · cience ...