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 City3 0 6 2 4 1 2 1 1 2 3 3 2 3 4 … Read more

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 can see, the mean of the sample is close to 5. 4.943504497663466 Regarding of how … Read more

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 a CSV. brands models 0 Tesla Model 3 1 Toyota RAV4 The CSV file is … Read more