Skip to content
Advertisement

Getting same result for different CSV files

DESCRIPTION: I have a piece of Python code, and this code takes a CSV file as input and produces a .player file as output. I’ve four different CSV files, hence, after running the code four times (taking each CSV file one by one), I’ve four .player files.

REPOSITORY: https://github.com/divkrsh/gridlab-d

DATA: The data in the CSV files are put through this code to produce a .player file as output in the range of 0 to 1. So, the code is supposed to read the second column of the CSV files and create a player file in the range of 0 to 1.

RUN:

JavaScript
JavaScript

output_directory

PROBLEM: The contents of all four .player files are the same. However, they should be different.

WHAT I NEED: Which part of the code is doing this? How can I correct this (i.e., receive different output for different CSV files)?

Advertisement

Answer

Analyzing the repository we can see:

x = np.arange(rows_to_make)

x = preprocessing.minmax_scale(x, feature_range=(0, rows_to_make), axis=0, copy=True)

y_new = preprocessing.minmax_scale(x, feature_range=(0, 1), axis=0, copy=True)

x is the same for every CSV file (depends on user input only). So it is definitely 3rd line fault here.

My guess is probably last line that I mentiod here (line 87 in repository) should be something like y_new = preprocessing.minmax_scale(y_new, feature_range=(0, 1), axis=0, copy=True)

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement