dataset.loc[ dataset['Age'] <= 16, 'Age'] = 0 dataset.loc[(dataset['Age'] > 16) & (dataset['Age'] <= 32), 'Age'] = 1 dataset.loc[(dataset['Age'] > 32) & (dataset['Age'] <= 48), 'Age'] = 2 dataset.loc[(dataset['Age'] > 48) & (dataset['Age'] <= 64), ...
kaggle上还可以下载test集,我们把train集得到的结果进行预测,然后根据kaggle的格式要求进行上传,kaggle给了样例的上传要求,仅有两列,一列为PassengerId,一列为Survived,我们也根据这样去生成符合标准的CSV文件。 test=pd.read_csv('D:\\dataset\\Titanic-test.csv') test.Age.fillna(test.Age.mean(),inplace=Tru...
from dataprep.datasets import load_dataset # 内置数据集 from dataprep.eda import plot # 绘图 from dataprep.eda import plot_correlation # 相关性 from dataprep.eda import create_report # 分析报告 from dataprep.eda import plot_missing # 缺失值 import warnings warnings.filterwarnings('ignore') In 2...
# for dataset in train_test_data: # dataset['Title'] = dataset['Name'].str.extract(' ([A-Za-z]+)\.', expand=False) # print(train['Title'].value_counts()) # # 统计名字前缀 # # title_mapping = {"Mr": 0, "Miss": 1, "Mrs": 2, # "Master": 3, "Dr": 3, "Rev": ...
Python数据分析库 - Pandas Foundations II (Study with Titanic Dataset) - Michelle小梦想家 353 1 54:29 App Python数据分析库 - Pandas Foundations III (Study with Titanic Dataset) - Michelle小梦想家 6542 21 17:58 App LeetCode in Python 1. Two Sum LeetCode - Michelle小梦想家 1536 -- 11:...
pythondata-sciencedata-visualizationtitanic-datasetcovid19-data UpdatedOct 14, 2023 Jupyter Notebook Data visualization tool for the Titanic dataset developed in Unity3D for the course Interaction in Mixed Reality Spaces at the University of Konstanz. ...
The Dataset was acquired fromhttps://www.kaggle.com/c/titanic For data preprocessing, I firstly defined three transformers: DataFrameSelector: Select features to handle. CombinedAttributesAdder: Add a categorical feature Age_cat which divided all passengers into three catagories according to their ages...
Titanic Dataset Kaggle Competition Beginner Python Copied from Krishnaraj_DataScience (+0,-0)NotebookInputOutputLogsComments (3)Output Data submission.csv(2.84 kB) get_app chevron_right PassengerIdSurvived89208931894089508961897089818990900190109020903090419050906190719080909091019111912091309141915091619170918191909200921092209...
Logsfile_downloadDownload Logs check_circle Successfully ran in 318.7s Accelerator None Environment Latest Container Image Output 0 B Time # Log Message 2.0s 1 [NbConvertApp] Converting notebook __notebook__.ipynb to notebook 4.8s 2 [NbConvertApp] Executing notebook with kernel: python3 ...
class TitanicDataset(Dataset): def __init__(self,filepath): xy = pd.read_csv(filepath) self.len = xy.shape[0] # xy.shape()可以得到xy的行列,[0]取行,[1]取列 #选取需要的特征 feature = ["Pclass", "Sex", "SibSp", "Parch", "Fare"] ...