fillna()会填充nan数据,并返回填充后的结果。
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch
from torch import nn
from torch.utils.data import Dataset,DataLoader,TensorDataset
dftrain_raw = pd.read_csv('./data/titanic/train.csv')
dftest_raw = pd.read_csv('./data/titanic/test.csv')
dftrain_raw.head(10)
dfdata = dftrain_raw
dfdata['Age'][:20]
fillna(0) 用0来填充缺失值
dfdata['Age'][:20].fillna(0)