CodeHurry Python Learning Center

Welcome to the Python Learning Center

Python Programming Examples

About This Collection

Unlike the SAS course materials on CodeHurry, which are organized into structured lessons, this Python section provides a limited collection of project-based code examples, along with several Python scripts covering Python basics and data analysis activities. It is intended as a practical programming reference for researchers, analysts, and programmers working with Python applications, rather than as a formal Python training course.

Programming Examples

Python Built-in and User-defined Functions, Key Language Concepts, and Path Manipulation

Covers print(), range(), enumerate(), user-defined functions, key Python language concepts, and Path methods.

Open Jupyter Notebook

Python Lists, Tuples, Loops, List Comprehension, and Pandas DataFrames

Analyzes U.S. state population data using Python and pandas.

Open Jupyter Notebook

Python Dictionaries and Sets for Data Analysis

Covers lookup, transformation, duplicate removal, and dataset comparison.

Open Jupyter Notebook

Folder and File Search in Python

Demonstrates folder navigation, file searching, and directory traversal in Python using the os pathlib modules.

Open Jupyter Notebook

DataFrames in Python

Creates pandas DataFrames in various ways.

Open Jupyter Notebook

Python Data Analysis with Pandas Functions

Demonstrates selected Pandas functions.

Open Jupyter Notebook

Finding, Renaming, and Copying index.html Files

Automates finding and copying all index.html files from multiple subdirectories into a single directory, prefixing each copied file with its original folder name.

View Code Code Description

Concatenating CSV Files and Producing Excel and HTML Versions

Combines multiple CSV files, removes duplicate links, sorts the dataset, and generates cleaned Excel and HTML outputs with clickable hyperlinks.

View Code Code Description

Excel to DataFrame to SAS Dataset

Combines multiple Excel worksheets into a single pandas DataFrame and exports the data as a SAS dataset.

View Code Code Description

Classifying Incident Descriptions (Project-Based)

Uses a rule-based system to categorize records involving violence against religious minorities in Bangladesh.

View Code
Code Description

Keywords List (Project-Based)

Defines category keywords and weights for classifying and scoring YouTube videos related to violence against religious minorities in Bangladesh.

View Code
Code Description

Search Queries (Project-Based)

Defines SEARCH_QUERIES, a collection of YouTube search phrases for identifying videos related to violence against religious minorities in Bangladesh.

View Code
Code Description

Automated YouTube Data API v3 Search (Project-Based)

Searches YouTube, classifies videos, and generates reports on violence against religious minorities in Bangladesh.

View Code
Code Description

Horizontal Bar Chart (Project-Based)

Creates a horizontal bar chart with Matplotlib to visualize incident frequencies by category.

View Code Code Description

Stacked Chart (Project-Based)

Creates a stacked chart with Matplotlib to visualize population counts by religion across census years.

View Code Code Description

Generating a Frequency Table and Exporting to a CSV File

Analyzes YouTube video publication years, displays the frequency distribution, and exports the results to a text file.

View Code Code Description

Understand Python Environment

Audits Python installations, environments, PATH settings, and Conda configuration on the computer.

View Code Code Description View Output
← Back to CodeHurry

Disclaimer

The Python programming materials provided on this website are intended for educational and reference purposes only. The author assumes no responsibility for errors, omissions, or consequences resulting from the use of these materials. Users should independently verify program logic, analytical assumptions, and results before applying these examples to their own research or production analyses.

Trademark Notice

Python® is a registered trademark of the Python Software Foundation. CodeHurry is not affiliated with, endorsed by, or sponsored by the Python Software Foundation. Python-related programming examples on this website are provided solely for educational and reference purposes.