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:

pip install -r requirements.txt

python player_adjuster.py Load1.csv
python player_adjuster.py Load2.csv
python player_adjuster.py Load3.csv
python player_adjuster.py Load4.csv
PS C:UsersJOHNDocumentsPYTHONGRIDLAB-D> python player_adjuster.py Load1.csv
.csv
> Enter starttime:
  Accepted format is 'YYYY-MM-DD HH:mm:ss'
? 2020-08-01 00:00:00
> Simulation Interval:
  Example acceptable values:
  1h, 10s, 5m, i.e. any other integer value followed by h,d,s or m
? 15m
> Player file name (dont provide extension.
  It will automatically have *.player extension
? Load1
PS C:UsersJOHNDocumentsPYTHONGRIDLAB-D>

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