Category: Pandas
How to Reorder Columns in DataFrame in Pandas Python
This tutorial shows how to reorder columns in dataframe using Pandas in Python. This tutorial includes 3 examples using the methods of reindex(), double brackets [[]], and pop(). Sample Dataframe The following is the sample dataframe in Python, which will...
Read Full Article →
Pandas: How to Select Rows Based on Column Values
This tutorial includes methods that you can select rows based a specific column value or a few column values by using loc() or query() in Python Pandas.
Read Full Article →
Python Correlation Real-World Examples
This tutorial shows how to apply correlation in real world. I will use the Peloton and covid example to illustrate this concept. In early 2021, a lot of consumers wanted to buy Peloton bikes but Peloton had difficulty meeting the...
Read Full Article →
How to Use Pandas Melt() Function
This short tutorial shows you how you can use melt() funtion in Pandas. It is often used when we need to change the format of dataframe to fit into a certain statistical functions. Example 1 of Using melt() City1 City2...
Read Full Article →
How to Calculate Mean in Python (NumPy)
This short tutorial shows how you can calculate mean in Python using NumPy. First, we generate the random data with mean of 5 and standard deviation (SD) of 1. Then, you can use the numpy is mean() function. As you...
Read Full Article →
Use t-test to Analyze Financial Well-being Data
Introduction Since we have covered the theoretical basics of t-test (see the tutorial here), it would be interesting to showcase how we can use t-test for a real-world application. In particular, we are going to use Financial well-being survey data to show...
Read Full Article →
How to Save Dataframes as CSV and xlsx Files in Python
This tutorial demonstrates how to save a dataframe as CSV and xlsx files in Python. Part 1: CSV Files We can first write a dictionary, then transform it into a dataframe. After that, we can use to_csv() save it as...
Read Full Article →