Skip to content

Latest commit

 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Energy Learning

This repository documents my Python learning journey with a focus on:

  • Data analysis
  • Numerical computing
  • Energy and power-system applications
  • Time-series analysis
  • Forecasting
  • Machine learning

The goal is to build a strong Python foundation and gradually apply it to real energy, grid, forecasting, and power-system problems.


Current Progress

Python Fundamentals

Topics covered:

  • Variables and data types
  • Input and output
  • Conditionals
  • Loops
  • Lists
  • Strings
  • Tuples
  • Sets
  • Dictionaries
  • Functions
  • Parameters and return values
  • Variable scope
  • Exception handling
  • try
  • except
  • else
  • finally
  • raise
  • File handling
  • Reading and writing files
  • Modules and packages
  • Import styles
  • __name__
  • Object-oriented programming
  • Classes and objects
  • Constructors with __init__
  • Instance attributes and methods
  • Class attributes
  • Inheritance
  • Method overriding
  • super()
  • Polymorphism
  • isinstance()
  • Class methods
  • Static methods
  • Properties and setters
  • Encapsulation
  • __str__
  • Composition
  • Abstract base classes
  • Abstract methods
  • Basic type hints

Statistics and Forecasting Basics

Topics covered:

  • Mean
  • Median
  • Range
  • Variance
  • Standard deviation
  • Population vs sample statistics
  • Z-scores
  • Moving averages
  • Basic time-series change calculations

Forecast evaluation metrics:

  • MAE
  • MSE
  • RMSE
  • MAPE
  • Bias

NumPy

NumPy foundation completed.

Topics covered:

Array Fundamentals

  • Creating ndarray objects
  • shape
  • ndim
  • size
  • dtype
  • 1D, 2D, and higher-dimensional arrays
  • Row and column vector concepts
  • Indexing
  • Slicing
  • Reverse slicing

Vectorized Operations

  • Vectorized arithmetic
  • NumPy ufuncs
  • Operator overloading
  • Elementwise calculations
  • Boolean masks
  • Filtering
  • Combining conditions with & and |
  • np.where()
  • np.argwhere()

Aggregations and Statistics

  • sum
  • mean
  • min
  • max
  • argmax
  • argmin
  • Range
  • Variance
  • Standard deviation
  • Median
  • Quantiles
  • Percentiles
  • ddof

Change and Cumulative Operations

  • np.diff()
  • Change detection
  • np.sign()
  • np.cumsum()
  • np.cumprod()

Normalization

  • Min-max normalization
  • Z-score standardization

Reshaping

  • reshape()
  • ravel()
  • flatten()
  • squeeze()
  • expand_dims()
  • np.newaxis
  • Transpose

Copies and Views

  • Views
  • Copies
  • Slicing behavior
  • Fancy indexing
  • ravel() vs flatten()

Broadcasting

  • Broadcasting rules
  • Shape compatibility
  • Row and column broadcasting

Combining Arrays

  • stack
  • vstack
  • hstack
  • column_stack
  • concatenate

Splitting Arrays

  • split
  • array_split
  • hsplit
  • vsplit

Array Utilities

  • unique
  • Frequency counts
  • take
  • delete
  • insert
  • append
  • repeat
  • tile
  • flip
  • sort
  • argsort
  • np.ix_

Array Creation

  • zeros
  • ones
  • full
  • eye
  • arange
  • linspace

Random Numbers

  • Random integer generation
  • Uniform random values
  • Normal distributions
  • Random seeds
  • Reproducibility

Data Types and Memory

  • int32
  • int64
  • float32
  • float64
  • astype()
  • Floating-point representation
  • itemsize
  • nbytes

Missing and Invalid Values

  • np.nan
  • np.isnan
  • np.isinf
  • np.isfinite
  • nanmean
  • nanmin
  • nanmax
  • nansum

Linear Algebra

  • Dot product
  • Matrix multiplication
  • Matrix-vector multiplication
  • Transpose
  • Symmetric matrices
  • Diagonal extraction
  • Trace
  • Upper and lower triangular matrices
  • Determinant
  • Matrix inverse
  • Solving linear systems
  • Vector norms
  • Unit vectors
  • Angle between vectors
  • Scalar projection
  • Vector projection
  • Orthogonal components
  • np.isclose()
  • np.allclose()
  • Eigenvalues
  • Eigenvectors
  • Verifying Av = λv

Pandas

Current pandas topics covered:

Series

  • Creating Series
  • Default and custom indexes
  • Label-based access
  • Position-based access
  • .loc
  • .iloc
  • Boolean filtering
  • Series attributes
  • .index
  • .values
  • .dtype
  • .shape
  • .size

DataFrames

  • Creating DataFrames from dictionaries
  • Selecting columns
  • Selecting rows
  • Scalar selection
  • Multiple-row and multiple-column selection
  • .loc
  • .iloc
  • Setting indexes
  • Resetting indexes
  • Index names
  • Boolean filtering

Sorting and Inspection

  • sort_values()
  • Sorting by multiple columns
  • sort_index()
  • head()
  • tail()
  • info()
  • describe()

Column Transformations

  • Creating derived columns
  • Boolean columns
  • Categorical columns with np.where()
  • Dropping rows and columns
  • Renaming rows and columns
  • value_counts()
  • unique()
  • nunique()

Missing Data

  • isna()
  • Missing-value masks
  • Missing-value counts
  • dropna()
  • fillna()
  • Filling with mean
  • Forward fill
  • Backward fill
  • Handling missing data by column

Duplicates

  • duplicated()
  • drop_duplicates()
  • Duplicate detection by subset
  • Keeping first or last duplicate

Data Type Conversion

  • astype()
  • pd.to_numeric()
  • errors="coerce"
  • Handling invalid numeric values

String Cleaning

  • .str accessor
  • str.strip()
  • str.lower()
  • str.split()
  • str.replace()
  • str.contains()
  • str.startswith()
  • str.endswith()
  • str.len()
  • str.extract()
  • Basic regular expressions
  • Mapping categories
  • .map()
  • .replace()

GroupBy and Aggregation

  • groupby()
  • Split-apply-combine concept
  • Mean
  • Sum
  • Min
  • Max
  • Count
  • Multiple aggregations
  • .agg()
  • Dictionary-based aggregation
  • Named aggregation
  • Grouping by multiple keys
  • MultiIndex results
  • reset_index()

Concatenation and Merging

  • pd.concat()
  • Vertical concatenation
  • Horizontal concatenation
  • Index alignment
  • merge()
  • Inner joins
  • Left joins
  • Right joins
  • Outer joins
  • Cross joins
  • left_on
  • right_on
  • right_index
  • Merge indicators
  • Merge validation
  • One-to-one
  • One-to-many
  • Many-to-one
  • Many-to-many
  • Duplicate-key row expansion
  • Merge suffixes

Pandas Time-Series Analysis

Topics covered:

Datetime Basics

  • pd.to_datetime()
  • datetime64[ns]
  • .dt accessor
  • Extracting:
    • Year
    • Month
    • Day
    • Hour
    • Minute
    • Second
    • Day name
    • Day of week
  • Weekend detection

DatetimeIndex

  • Setting timestamps as index
  • Sorting datetime indexes
  • Partial datetime selection
  • Datetime slicing
  • Date-based filtering

Resampling

  • resample()
  • Hourly resampling
  • Daily resampling
  • Mean aggregation
  • Sum aggregation
  • Multiple aggregations
  • Frequency aliases

Power and Energy Calculations

  • Power vs energy distinction
  • Converting power samples to energy
  • Regular sampling intervals
  • 30-minute measurements
  • Energy_MWh = Power_MW × interval_hours
  • Hourly power averages
  • Hourly energy totals

Rolling Windows

  • Row-based rolling windows
  • Time-based rolling windows
  • Rolling mean
  • Rolling maximum
  • Rolling minimum
  • Rolling range
  • min_periods
  • Regular vs irregular sampling
  • Time-window boundary behavior
  • closed="both"

Lag Features

  • shift()
  • Lag-1 features
  • Lag-2 features
  • Lag-3 features
  • Previous-value features
  • Power differences
  • Percentage changes
  • pct_change()
  • Forecasting feature intuition

Regular Time-Series Creation

  • pd.date_range()
  • periods
  • freq
  • 30-minute sampling
  • Regular time indexes

Interpolation

  • Linear interpolation
  • Time-based interpolation
  • Interpolation vs extrapolation
  • Interpolation with one missing value
  • Interpolation with multiple missing values
  • Position-based interpolation
  • Time-weighted interpolation
  • Regular vs irregular timestamps

Missing Timestamps

  • Difference between missing values and missing rows
  • Restoring expected frequencies with asfreq()
  • Creating expected time indexes
  • Detecting missing timestamps with Index.difference()
  • Dynamic expected indexes using:
    • .index.min()
    • .index.max()
  • Missing timestamp masks
  • Missing-value counts

Reusable Time-Series Utilities

Built helper functions for:

  • Detecting missing timestamps
  • Handling empty DataFrames
  • Validating DatetimeIndex
  • Raising TypeError
  • Combining validation with:
    • try
    • except
    • else

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages