"""
# import libraries
"""
import numpy as np
import pandas as pd

from tqdm.notebook import tqdm
from dataclasses import make_dataclass
"""
# load data
"""
train = pd.read_csv("../input/titanic/train.csv")
"""
# make data class 
"""
"""
##### data class name : "NewInfo" 
##### variables : "PassengerId","Name","Age","Sex" 
"""
NewInfo = make_dataclass("NewInfo",  
                         [
                             ("PassengerId", int), 
                             ("Name", str),
                             ("Age",int),
                             ("Sex",str)
                         ]
                        )
"""
# make new data list using make_dataclass
"""
dataList=[]

for i in tqdm(range(len(train))):
    PassengerId=train.loc[i,'PassengerId']
    Name=train.loc[i,'Name']
    Age=train.loc[i,'Age']
    Sex=train.loc[i,'Sex']

    dataList += [NewInfo(PassengerId,Name,Age,Sex)]
    
dataList[:5]
"""
# data list => dataframe
"""
new_df = pd.DataFrame(dataList)
new_df = new_df.set_index(["PassengerId"])
new_df.head()