sound-data / DEER-Prototypes-EnergyPlus

11 stars 4 forks source link

SfM.py possible bug #42

Open Justin-DeBlois opened 3 months ago

Justin-DeBlois commented 3 months ago

When creating a new row in normunit.csv for residential doors, SFm.py gave an error:

Traceback (most recent call last): File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py", line 3653, in get_loc return self._engine.get_loc(casted_key) File "pandas_libs\index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc File "pandas_libs\index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc File "pandas_libs\hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas_libs\hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 0

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "c:\Github\DEER-Prototypes-EnergyPlus-Working\scripts\data transformation\SFm.py", line 451, in numunits = numunits_vals[0] File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\frame.py", line 3761, in getitem indexer = self.columns.get_loc(key) File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py", line 3655, in get_loc raise KeyError(key) from err KeyError: 0

I was able to fix this by changing line 451 from numunits = numunits_vals[0] to numunits = list(numunits_vals['Value'])[0]

I still get the following error, but the script does run:

A value is trying to be set on a copy of a slice from a DataFrame.

Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy sim_annual_f['BldgVint'] = sim_annual_f['BldgLoc'].map(cz_vint_dict)

MFm.py and DMo.py run successfully with the new normunit.

lyt5410 commented 3 months ago

@Justin-DeBlois can you provide a copy of the Normunits.xlsx file you are using? I will debug this.

Justin-DeBlois commented 3 months ago

Thanks, I'm using "Each", below Normunits.xlsx