Skip to content

Commit

Permalink
Make sure to remove duplicate columns from results, which was causing…
Browse files Browse the repository at this point in the history
… errors..
  • Loading branch information
cdeline committed Sep 9, 2024
1 parent 9d1791e commit 912fb60
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bifacial_radiance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4373,9 +4373,10 @@ def results(self):
results = pd.DataFrame.from_dict(resultdict, orient='index').T.rename(
columns={'modWanted':'modNum', 'rowWanted':'rowNum'})
if getattr(self, 'power_data', None) is not None:
return pd.concat([results, self.power_data], axis=1)
results = pd.concat([results, self.power_data], axis=1)
return results.loc[:,~results.columns.duplicated()]
else:
return results
return results.loc[:,~results.columns.duplicated()]
except AttributeError:
return None

Expand Down
1 change: 1 addition & 0 deletions bifacial_radiance/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def calculatePerformance(module, csvfile=None, results=None,
dfst['sceneNum'] = data['sceneNum']
else:
if results is not None:
results = results.loc[:,~results.columns.duplicated()]
Wm2Front = pd.DataFrame.from_dict(dict(zip(
results.index, results['Wm2Front']))).T
Wm2Back = pd.DataFrame.from_dict(dict(zip(
Expand Down
1 change: 1 addition & 0 deletions tests/test_bifacial_radiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def test_1axis_gencumSky():
index_col=0).iloc[:,0]
module.addCEC(CECMod)
results = demo.calculatePerformance1axis(module=module)
results = demo.calculatePerformance1axis(module=module)
pd.testing.assert_frame_equal(results, demo.compiledResults)
assert results.iloc[0].Grear_mean == pytest.approx(210, abs=30) #gencumsky has lots of variability
assert results.__len__() == 4
Expand Down

0 comments on commit 912fb60

Please sign in to comment.