Question: Please define a python class as described below: Constructor : Takes the name of the data file as its only parameter. The constructor will use

Please define a python class as described below:

  • Constructor: Takes the name of the data file as its only parameter. The constructor will use Pandas to load the data from the file into a pandas DataFrame. It will then extract the data values form the DataFrame and save it in an instance variable of type numpy array called data.
  • A method called stats: This method will use aggregators to find max, min, sum, mean, standrad deviation of each column. The results should be stored in numpy arrays representing each computation. For example, the max array should hold max values of the columns.
  • A method called normalize: This method will use broadcasting to normalize each column of the data to the corresponding column's mean and standard deviation. That is, the standard deviation of each column is subtracted from each data point in the column and the result is then divided by the mean of that column. The method should first call the stats methods and then use stats produced to accomplish its tasks. Here is the formula that summarizes what needs to be done:

Please define a python class as described below: Constructor: Takes the name

  • A method called plot_data: This method will take as input the following:
    • axis: This is the axis for the plot
    • feature: This is the feature to be plotted
    • normalize: This is a Boolean value indicating if the normalized data (True) or the original data should be plotted. Default should be True.
    The method should then plot the data as indicated.
  • A method called save_normalized_data_csv: This method should take as input the name of the output file and then save the normalized data as csv in the corresponding file. HINT: Convert the normalized data to a DataFrame and then save the DataFrame to the file. Bes sure to set index=False when saving the data frame so that the index is not produced to the output file.
  • A method called save_normalized_data_pickle: This method should take as input the name of the output file and then save the normalized data in the corresponding file in binary. HINT: Convert the normalized data to a DataFrame and then save the DataFrame to the file.

(1) (i) x; -std(x;) x_normalized. mean(x;) X; is the sample values of column x") is the ith sample value of columni std(x;) is the standard deviation of columni mean(x;) is the mean of column j, and x_normalized) is the normalized value of the ith sample of column j. (i (1) (i) x; -std(x;) x_normalized. mean(x;) X; is the sample values of column x") is the ith sample value of columni std(x;) is the standard deviation of columni mean(x;) is the mean of column j, and x_normalized) is the normalized value of the ith sample of column j. (i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!