
See how this course helps finance and business professionals move from Excel to Python pandas using real-world data analysis workflows.
Follow a practical data analysis flow from importing data through inspecting, understanding structure, cleaning, manipulating, and summarizing, to exporting data for use in Excel.
Learn pandas and Python using your own data, guided by a task-based course from importing to exporting. Emphasizes active learning, digital notes, and keyboard shortcuts in Jupyter notebooks.
Explore how the Our World in Data dataset is sourced and shared on GitHub under a Creative Commons license, used as covid-context example for active learning with your own data.
Learn how to install Python across different systems, find Python.org downloads, use Anaconda Navigator to launch Jupyter Notebooks, and run notebooks in a web browser.
Learn to use Jupiter notebooks for Python in finance, including creating a Python 3 notebook, navigating cells in command and edit modes, and using keyboard shortcuts.
Learn how Jupyter notebooks color code strings in red, comparisons in purple, numbers and groupings in green, keywords in dark green, and user-defined functions in blue; ctrl+/ toggles comments.
Introduction and Setup
Demonstrated small bits of Python code.
Introduced the Pandas library and its significance.
Explained the importing process of a dataset (Our World in Data COVID codebook) into a CSV file using the read_csv() function.
Object-Oriented Programming (OOP) in Python
Everything in Python is essentially an object.
Individual elements are objects.
Sets or groups of elements (e.g., data in a column) are also objects.
Collections, like column labels, are objects.
Function inputs can also be objects.
Briefly touched upon functions, mentioning how they can accept objects as parameters.
Python Syntax and Notation
Highlighted that Python is case-sensitive.
Example: The case difference between variables affects code execution.
Discussed dot notation:
Used for accessing elements or functions from libraries or objects.
Demonstrated with the pd.read_csv() function and accessing column values.
Introduced the index operator:
Explained its use with square brackets to access specific elements within objects.
Differentiated between list notation and the index operator.
Briefly touched on the concept of indexes in data structures.
Accessing Documentation in Pandas
Stressed the importance of referring to the Pandas documentation.
Demonstrated two methods to access documentation:
Using the Shift + Tab shortcut in Jupyter notebooks.
Searching for specific functions or topics online, ideally on the official pandas documentation website.
Differentiated between parameters and arguments in function calls.
Emphasized the usefulness of documentation for understanding functions, parameters, and more.
In this lecture, students will delve deeper into Python by understanding:
Attributes:
Attributes give information about an object.
Attributes are accessed using dot notation.
Examples on how to retrieving the size of a dataframe and how to accessing column labels using attributes.
An attribute is distinguished from a function by its plain text right after an object, without parentheses.
Functions:
Functions perform predefined tasks on objects.
They are often used for routine tasks and are invoked with parentheses.
Examples of functions provided include the read_csv() function to import data and the head() function to display the initial rows of a dataframe.
Functions can take arguments, which determine their specific behaviour.
Method Chaining: allows for performing multiple operations successively.
Parameter vs. Argument:
A parameter is a variable in the definition of a function.
An argument is the actual value that gets passed into the function.
Some functions have default arguments, which means they assume a specific value unless provided otherwise by the user.
Importance of Documentation:
For further guidance, consulting function documentation will be very useful to determine the list of parameters and their default values.
Explore lists, tuples, and dictionaries in Python, using square brackets for lists, parentheses for tuples, and curly braces for dictionaries, with index access and key-value mappings.
Explore the index in the pandas library, its zero-based and immutable properties, and how to reference it versus column labels using the index operator and axis.
Choose which columns to import using the read function's use parameter, referencing either index keys or column labels. Store the column list to simplify keeping or excluding columns.
Learn to set a pandas dataframe index by column label or position using the index parameter, and build a multi-index by passing a list of index keys.
Rename column labels by passing a list to the names parameter and set header equals zero to avoid header row; illustrate read Excel behavior and store labels in a variable.
Exclude the bottom rows from Excel imports with the skip footer parameter in read Excel functions; note it is not zero-based, and you may need to specify the Python engine.
Limit how many rows import with the enrols parameter, from the top of the source data. Observe that the first line holds column labels and indexing is zero-based.
In Python for finance professionals, learn to control import behavior by adjusting the skip blank lines parameter to keep or exclude blank rows when loading data into a data frame.
Learn how to customize null values during data import by using the na_values parameter, adding strings like Asia, Africa, and not applicable to be treated as missing.
Discover how to convert numeric columns containing blanks from read operations into string/object dtype by using astype with a column-to-type dictionary, inspecting dtypes, and managing decimals.
Convert date columns to the date time data type in Python for finance by identifying object-typed dates, using the dot info function, and listing target columns by label or index.
Clarify index terminology in Python for finance professionals, distinguishing index, index position, index key, and index label; explain the index operator using square brackets to access rows and columns.
Use the set_index function to assign the first column or multiple columns as the index, and learn how drop and in-place options affect the data.
Set and reset index labels in a data frame, convert index columns back to data columns, and control dropping with the drop parameter, including single or multiple indices.
Learn how to swap the order of multi index levels in a data frame using the swap level function, with two- and three-level examples and label or position references.
Sort data by the index using sort_index to reorder both the index and rows, handling single or multi-index cases with level controls and ascending options.
Search index labels with the index attribute and in function to test exact casing. Filter the data frame with the resulting boolean array via the index operator, noting copy warnings.
Use df.info to inspect dataframe attributes, revealing columns, labels, non-null counts, and data types, including floats and objects, with numeric columns defaulting to float. Verify size with df.shape and df.size.
Count the occurrences of distinct column values with value_counts, reference columns by attribute or index, sort results from high to low, and handle nulls with dropna and isna.
Explore descriptive statistics for numeric data frames using describe; display non-null counts, mean, min, max, and std with quartiles, transpose for readability, and apply min, max, mean, and median.
Derive cumulative max, min, and sum values from numeric columns in a data frame by filtering to numeric columns, then apply row-wise cumulative functions to track highs, lows, and totals.
Learn to detect null values in a data frame using isna and related functions, count nulls with sum, and reference columns by attribute or with the index operator for spaces.
Compare two columns in a data frame, such as total cases and new cases, using a comparison operator or its method, then filter rows by the boolean result.
Learn to compare index labels and filter a data frame by its index using index attribute and operator, and use is in and negation to include or exclude values.
Learn to compare columns across two dataframes using a method or the isin function, including filtering to AFGE rows and cross-frame matching.
Explore Python data types used in finance analytics, including object, string, integer, float, boolean, categorical, and date/time, and learn how nulls and mixed data affect type inference and conversion.
Convert a date column to datetime in a pandas data frame with pd.to_datetime, assign the result to the date column to update the type, and verify with the column's types.
Level up your Excel data analysis skills by transitioning from Excel to Python seamlessly with my tailored course designed exclusively for professionals. Discover the power of the Python's Pandas library in handling large datasets, automating boring and repetitive tasks, and simplifying data management.
What sets this course apart?
Real-world Application: This course isn’t a generic Python tutorial. It's crafted by a seasoned finance professional for professionals. Hence, every lesson, tip, and trick is rooted in real-life scenarios.
From Basics to Advanced: Whether you're a novice or someone who's dabbled in Python before, this course caters to all. It commences with the foundational aspects of Python and Pandas and gradually dives into advanced techniques ensuring a comprehensive learning experience.
Practical Focus: We understand that finance professionals mostly deal with CSV and Excel files. This course primarily revolves around these, but we also touch upon importing data in varied formats.
End-to-end Learning: Apart from learning Python and Pandas, get acquainted with the Jupyter Notebooks programming environment. Follow along as we delve deep into importing, inspecting, and manipulating data. Master the art of data cleaning using string functions, and ascertain ways to avoid errors. Conclusively, we’ll guide you on summarizing your data, ensuring it’s export-ready.