Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Solutions pandas

Technische Universität Berlin

Power Plants Data

In this exercise, we will use the powerplants.csv dataset from the powerplantmatching project. This dataset contains information about various power plants, including their names, countries, fuel types, capacities, and more.

URL: https://raw.githubusercontent.com/PyPSA/powerplantmatching/master/powerplants.csv

Task 1: Load the dataset into a pandas DataFrame.

Notebook Cell

Task 2: Run the function .describe() on the DataFrame.

Notebook Cell
Loading...

Task 3: Provide a list of unique fuel types and technologies included in the dataset.

Notebook Cell
array(['Hydro', 'Hard Coal', 'Natural Gas', 'Nuclear', 'Lignite', 'Wind', 'Solid Biomass', 'Oil', 'Waste', 'Solar', 'Battery', 'Hydrogen Storage', 'Geothermal', 'Heat Storage', 'Other', 'Biogas', 'Mechanical Storage'], dtype=object)
Notebook Cell
array(['Pumped Storage', 'Reservoir', 'Run-Of-River', 'Steam Turbine', 'CCGT', 'Onshore', 'OCGT', nan, 'PV', 'Li', 'Csp', 'Offshore', 'Pb', 'NaS', 'NiCd', 'Laes', 'CSP', 'CAES', 'Molten Salt', 'Fe', 'V', 'Flywheel', 'NaNiCl', 'Combustion Engine'], dtype=object)

Task 4: Filter the dataset by power plants with the fuel type “Hard Coal”.

Notebook Cell
Loading...

Task 5: Identify the 5 largest coal power plants. In which countries are they located? When were they built?

Notebook Cell
Index([778, 321, 216, 2165, 4205], dtype='int64', name='id')
Notebook Cell
Loading...

Task 6: Identify the power plant with the longest name.

Notebook Cell
Name Grn Gesundheitszentren Rhein Neckar Ggmbh Pv A... Fueltype Solar Technology PV Set PP Country Germany Capacity 0.4455 Efficiency NaN DateIn 2026.0 DateRetrofit NaN DateOut NaN lat 49.549434 lon 8.643048 Duration NaN Volume_Mm3 NaN DamHeight_m NaN StorageCapacity_MWh NaN EIC {nan} projectID {'MASTR': {'MASTR-SEE935883906029'}} Name: 106579, dtype: object

Task 7: Identify the 10 northernmost powerplants. What type of power plants are they?

Notebook Cell
Loading...

Task 8: What is the average start year of each fuel type? Sort the fuel types by their average start year in ascending order and round to the nearest integer.

Notebook Cell
Fueltype Hydrogen Storage 1970.0 Hard Coal 1971.0 Hydro 1973.0 Lignite 1978.0 Nuclear 1980.0 Other 2001.0 Oil 2003.0 Geothermal 2004.0 Waste 2005.0 Solid Biomass 2007.0 Biogas 2012.0 Wind 2013.0 Natural Gas 2014.0 Solar 2018.0 Battery 2024.0 Heat Storage NaN Mechanical Storage NaN Name: DateIn, dtype: float64

Wind and Solar Capacity Factors

In this exercise, we will work with a time series dataset containing hourly wind and solar capacity factors for Ireland, taken from model.energy.

Task 1: Use pd.read_csv to load the dataset from the following URL into a pandas DataFrame. Ensure that the time stamps are treated as pd.DatetimeIndex.

Notebook Cell

Task 2: Calculate the mean capacity factor for wind and solar over the entire time period.

Notebook Cell
onwind 0.366898 solar 0.099274 dtype: float64

Task 3: Calculate the correlation between wind and solar capacity factors.

Notebook Cell
Loading...

Task 4: Plot the wind and solar capacity factors for the month of May.

Notebook Cell
<Axes: ylabel='capacity factor'>
<Figure size 640x480 with 1 Axes>

Task 5: Plot the weekly average capacity factors for wind and solar over the entire time period.

Notebook Cell
<Axes: >
<Figure size 640x480 with 1 Axes>

Task 6: Go to model.energy and retrieve the time series for another region of your choice. Recreate the analysis above and compare the results.