question archive ormalization(fname, attr, normType) This function takes in the location of the data file, the attribute that has to be normalised (one of the values from 'Open','High','Low','Close','Volume') and the type of normalization to be performed('min_max' or 'z_score') Based on the normalisation type that is mentioned, you will have to apply the appropriate formula and return a dictionary where key = original value in the dataset, value = normalised value A sample dataset has been provided to you at this location "

ormalization(fname, attr, normType) This function takes in the location of the data file, the attribute that has to be normalised (one of the values from 'Open','High','Low','Close','Volume') and the type of normalization to be performed('min_max' or 'z_score') Based on the normalisation type that is mentioned, you will have to apply the appropriate formula and return a dictionary where key = original value in the dataset, value = normalised value A sample dataset has been provided to you at this location "

Subject:Computer SciencePrice:9.82 Bought5

ormalization(fname, attr, normType)

This function takes in the location of the data file, the attribute that has to be normalised (one of the values from 'Open','High','Low','Close','Volume') and the type of normalization to be performed('min_max' or 'z_score')

Based on the normalisation type that is mentioned, you will have to apply the appropriate formula and return a dictionary where key = original value in the dataset, value = normalised value

A sample dataset has been provided to you at this location "./data/HistoricalQuotes.csv". Use this dataset to test the functionality you are building.

correlation (fname1, attr1, fname2, attr2)

This function takes in the location of the first data file, the attribute that has to be used in the first file, the location of the second data file and the attribute that has to be used in the second file.

This function has to calculate the correlation coefficient between the two attributes mentioned in the two files.

Two Sample datasets have been provided to you in "./data/test1.csv" and "./data/test2.csv" respectively.

The two sample files have the following attributes 'Open','High','Last','Low','Volume'. Use these two sample files to test the functionality you are building.

 

I have already finished the code, but I am trying to switch one line from .loc to .iloc, and I keep getting an error:

 

def normalization (fname, attr, normType):

    '''

    Input Parameters:

        fname: Name of the csv file contiaining historical quotes

        attr: The attribute to be normalized

        normType: The type of normalization

    Output:

        a dictionary where each key is the original column value and each value is the normalised column value.

    '''

    result = {}  

    df = pd.read_csv(fname)

    col = df.iloc[int(1):int(5)]

 

    min_val = col.min()

    max_val = col.max()

    diff = max_val - min_val

 

    stdev = col.std()

    mean = col.mean()

 

    if normType == "min_max":

        for i in range(col.size):

            result[col[i]] = (col[i] - min_val) / diff

    else:

        for i in range(col.size):

            result[col[i]] = (col[i] - mean) / stdev

 

    return result

 

 

 

normalization("./data/HistoricalQuotes.csv", "Open", "min_max")

Option 1

Low Cost Option
Download this past answer in few clicks

9.82 USD

PURCHASE SOLUTION

Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

rated 5 stars

Purchased 5 times

Completion Status 100%