How to Convert Dictionary to Pandas DataFrame

You may use the following template to convert a dictionary to pandas DataFrame: from pandas import DataFrame my_dict = {key:value,key:value,key:value,…} df = DataFrame(list(my_dict.items()),columns = [‘column1′,’column2′]) In this short tutorial, I’ll review the steps to convert a dictionary to pandas DataFrame. I’ll also share the code to create the following tool to convert your dictionary to …

How to Create a Pie Chart using Matplotlib

Need to create a pie chart using matplotlib? If so, you can use the following template to create your pie chart: import matplotlib.pyplot as plt my_data = [value1,value2,value3,…] my_labels = ‘label1′,’label2′,’label3′,… plt.pie(my_data,labels=my_labels,autopct=’%1.1f%%’) plt.title(‘My Title’) plt.axis(‘equal’) plt.show() Next, I’ll review an example with the steps to create different types of pie charts. Steps to Create a …

How to Convert Integers to Floats in Pandas DataFrame

In this short guide, I’ll review two methods to convert integers to floats in Pandas DataFrame: (1) The astype(float) method: df[‘DataFrame Column’] = df[‘DataFrame Column’].astype(float) (2) The to_numeric method: df[‘DataFrame Column’] = pd.to_numeric(df[‘DataFrame Column’], downcast=’float’) In the next section, I’ll review an example with the steps to apply the above two methods in practice. Steps …