For this week's Project we had to create a data file that would read be able to read in csv files. Then, we made an analysis file to perform certain functions with numpy. Some examples of this are a mean function and a standard deviation function.
1.) For step 1 we had to update our data class we made in lab to be able to handle numeric forms of data.In order to do this we had to first edit our read method so that it would convert the string data in the csv to type float. Then these numeric values were stored in a numpy matrix. We then had to add some new fields and accessor methods to make sure we could access our data.
2.) For step 2, we had to create our analysis file. This file essentially takes in a certain column and then analyzes it through the various function we had to create. We created a data_range function that grabs the min and max of a column, a function that calculates the mean of a column, a function that calculates the standard deviation of a function, and then two normalizing functions: one that normalized columns separately and one that did it together. These functions were made with the assistance of the numpy package. I then created a test function to make sure that everything worked.
3.) For step 3 we had to find our own data set csv file and convince everyone that it worked. I did this by using a CSV file of some MLB statistics. I opened it in excel and calculated the mean and standard deviation of each column. Then, I created a test function that did the same thing. The numbers matched which means I did it correctly.
Here is my test function in cmd
From this project I learned how to create a file that would read in files and convert the data in it to numeric values. I also learned how to use the numpy package in order to work with matrices and also in order to calculate certain mathematical functions such as standard deviation and mean.
1.) The result of my extensions can be seen in the image above. I chose to create some additional methods in the analysis file. One of my functions finds the sum of a column. The other function can round my matrix to a certain amount of decimal places.
Tony Karalekas, Brendan Doyle, CP, Julia Saul, Bruce, Numpy Documentation