PyPSA / PyPSA

PyPSA: Python for Power System Analysis
https://pypsa.readthedocs.io
MIT License
1.25k stars 456 forks source link

Please update/clarify documentation "Using the statistics modules.." #938

Closed fhg-isi closed 4 months ago

fhg-isi commented 4 months ago

Version Checks (indicate both or one)

Issue Description

I tried to follow doc at https://pypsa.readthedocs.io/en/latest/examples/statistics.html

and get errors for

curtailment = statistics.curtailment()

=>

AttributeError: 'DataFrame' object has no attribute 'curtailment'. Did you mean: 'Curtailment'?

curtailment = statistics.Curtailment()

=>

    cur = statistics.Curtailment()
          ^^^^^^^^^^^^^^^^^^^
TypeError: 'Series' object is not callable

=> Please update getting started and API documentation.

https://pypsa.readthedocs.io/en/latest/api_reference.html#module-pypsa.statistics

statistics.columns

gives me

Index(['Optimal Capacity', 'Installed Capacity', 'Supply', 'Withdrawal',
       'Dispatch', 'Transmission', 'Capacity Factor', 'Curtailment',
       'Capital Expenditure', 'Operational Expenditure', 'Revenue',
       'Market Value'],
      dtype='object')

According to doc on dispatch:

Deprecated since version 0.28: This will be removed in 0.29. Use ‘energy_balance’ instead.

=> Should I still use deprecated 'Dispatch' ? Or energy_balance? How to access energy_balance in version 0.28?

Reproducible Example

No response

Expected Behavior

No response

Installed Versions

Replace this line.
fhg-isi commented 4 months ago

My error.

One needs to use statistics without (): n.statistics.curtailment() instead of n.statistics().curtailment()