import pandas as pd import matplotlib.pyplot as plt # Create the DataFrame data = { 'Feature1': [10, 20, 30, 40, 50], 'Feature2': [100, 200, 300, 400, 500] } df = pd.DataFrame(data) # Calculate the sum of each feature for pie chart visualization sizes = [df['Feature1'].sum(), df['Feature2'].sum()] # Labels for the pie chart labels = ['Feature1', 'Feature2'] # Plotting the Pie Chart plt.pie(sizes, labels=labels) plt.title("Proportion of Feature1 and Feature2") plt.show()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter