Skip to content

Commit eaa1731

Browse files
committed
DataFrame bugfix
1 parent 9563da7 commit eaa1731

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

windpowerlib/wind_farm.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,16 @@ def assign_power_curve(self, wake_losses_model='power_efficiency_curve',
258258
else:
259259
# Add value zero to start and end of curve as otherwise there
260260
# can occure problems during the aggregation
261-
if power_curve.iloc[0]['wind_speed'] != 0:
262-
power_curve.loc[power_curve.index[0] - 0.5] = [
263-
power_curve.index[0] - 0.5, 0.0]
261+
if power_curve.iloc[0]['wind_speed'] != 0.0:
262+
power_curve = pd.concat(
263+
[power_curve, pd.DataFrame(data={
264+
'power': [0.0], 'wind_speed': [0.0]})])
264265
if power_curve.iloc[-1]['power'] != 0.0:
265-
power_curve.loc[power_curve.index[-1] + 0.5] = [
266-
power_curve.index[-1] + 0.5, 0.0]
266+
power_curve = pd.concat(
267+
[power_curve, pd.DataFrame(data={
268+
'power': [0.0],
269+
'wind_speed': [power_curve['wind_speed'].loc[
270+
power_curve.index[-1]] + 0.5]})])
267271
# Add power curves of all turbine types to data frame
268272
# (multiplied by turbine amount)
269273
df = pd.concat(

0 commit comments

Comments
 (0)