text_html_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

dtrain = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv')

dtest = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv')

dtrain.isna().sum()

def func(pct, allvals):
    absolute = int(np.round(pct / 100.0 * np.sum(allvals)))
    return f'{pct:.1f}%\n({absolute:d})'
transported = dtrain[dtrain['Transported'] == False]
transported_count = transported.groupby('HomePlanet').Transported.count()

transported = dtrain[dtrain['Transported'] == True]
transported_count = transported.groupby('HomePlanet').Transported.count()

transported = dtrain[dtrain['Transported'] == False]
transported_count = transported.groupby('VIP').Transported.count()

transported = dtrain[dtrain['Transported'] == True]
transported_count = transported.groupby('VIP').Transported.count()
plt.pie(transported_count, autopct=lambda pct: func(pct, transported_count), textprops=dict(color='w'))
plt.title('VIP that were transported', fontsize=16)
print(transported_count)