博雅数据机器学习01
作者:互联网
博雅数据机器学习01
今天在博雅数据平台上学习观看机器学习的视频
数据预处理
One-hot编码
import pandas as pd
data = pd.read_csv('user_review.csv')
# 请在下方作答 #
print(data['User continent'].value_counts(dropna = False))
encode_uc = pd.get_dummies(data['User continent'], prefix = 'User continent_')
encode_uc.head()
缺失值填补
import pandas as pd
data = pd.read_csv('user_review.csv')
# 请在下方作答 #
print(data['Traveler type'].value_counts(dropna = False))
freq_v = 'Couples'
### 缺失值填充
data['Traveler type'] = data['Traveler type'].fillna(freq_v)
### 打印
print('')
print(u'缺失值填充完之后:')
print('')
print(data['Traveler type'].value_counts(dropna = False))
标签:01,机器,博雅,pd,type,print,Traveler,csv,data 来源: https://www.cnblogs.com/xueqiuxiang/p/14466950.html