Data Science with Python — CCPP case
A practical case of exploratory data analysis with pandas and matplotlib: exploring the relationship between environmental variables and electrical power generated by a Combined Cycle Power Plant.
The dataset is freely available at the UCI Machine Learning Repository — it contains 9,568 observations collected over 6 years of operation from a real power plant:
https://archive.ics.uci.edu/ml/datasets/Combined+Cycle+Power+Plant
The available variables are:
- AT — Ambient Temperature (°C)
- V — Exhaust Vacuum (cm Hg)
- AP — Ambient Pressure (hPa)
- RH — Relative Humidity (%)
- EP — Hourly Net Electrical Energy Output (MW)
The objective is to quantify how ambient pressure (AP) influences generated power (EP).
import pandas as pd
import matplotlib.pyplot as plt
# Importing the dataset
dataset = pd.read_excel("Combined_Cycle_Power_Plant_Data_Set.xlsx")
print(f"Showing the header of the dataset: \n {dataset.head()}")
# Plotting AP and EP data
plt.scatter(dataset['AP'], dataset['EP'])
plt.xlabel('Ambient Pressure (AP)')
plt.ylabel('Net Hourly Electrical Energy Output (EP)')
plt.title('Relationship between AP and EP')
plt.show()
# Calculating the correlation between AP and EP
correlation = dataset['EP'].corr(dataset['AP'])
print(f"The correlation between AP and EP is: {correlation:.4f}")
The numerical output:
The correlation between AP and EP is: 0.5185

The Pearson correlation between AP and EP is approximately \(r \approx 0.52\) — a moderate positive relationship. Mathematically:
Physical interpretation: when ambient pressure increases, air density rises, improving mass flow rate of air through the gas turbine, and the plant delivers more power. The correlation is not perfect because AT (temperature) and V (condenser vacuum) have much stronger influence on EP (\(r_{AT,EP} \approx -0.95\)).
Typical next steps:
- Full correlation matrix (
dataset.corr()) + heatmap with seaborn - Fitting a multivariate linear model (
sklearn.linear_model.LinearRegression) using AT, V, AP, RH as predictors - Evaluation with \(R^2\) and RMSE on a train/test split
Installation:
pip install pandas matplotlib openpyxl