当前位置: 首页 > news >正文

做网络推广的网站有哪些好推建站

做网络推广的网站有哪些,好推建站,做网站需要源码吗,提供网站制作公司哪家好pytorch笔记篇:pandas之数据预处理 pytorch笔记篇:pandas之数据预处理(更新中)测试例代码相关的算子 pytorch笔记篇:pandas之数据预处理(更新中) 测试例代码 print(train_data.iloc[0:4, [0, 1, 2, 3, -3, -2, -1]]) # (※1) 为什么test_da…

pytorch笔记篇:pandas之数据预处理

  • pytorch笔记篇:pandas之数据预处理(更新中)
    • 测试例代码
    • 相关的算子

pytorch笔记篇:pandas之数据预处理(更新中)

测试例代码

print(train_data.iloc[0:4, [0, 1, 2, 3, -3, -2, -1]])
# (1) 为什么test_data的列最后不是-1,是因为test_data没有价格这个列项
all_features = pd.concat((train_data.iloc[:, 1:-1], test_data.iloc[:, 1:]))
print('-----------------------------------------------')
print(all_features.iloc[0:4, [0, 1, 2, 3, -3, -2, -1]])# (2) 获取到不是数值的列index]
numeric_features = all_features.dtypes[all_features.dtypes != 'object'].index# print('++++++++++++++++++++++++')
# (3) print(all_features[numeric_features].iloc[0:3, [0,1,2,3,-3,-2,-1]])
# print('----------------------')
all_features[numeric_features] = all_features[numeric_features].apply(lambda x: (x - x.mean()) / (x.std()))
# print(all_features[numeric_features].iloc[0:3, [0,1,2,3,-3,-2,-1]])
# input()# (4) 在标准化数据之后,所有均值消失,因此我们可以将缺失值设置为0
all_features[numeric_features] = all_features[numeric_features].fillna(0)# (5) dummies & pd to tensor
print('++++++++++  demo test dummies  +++++++++++')
test = pd.DataFrame({'“x”':[1,2,3,4,5, 6], "seasion":['here', 'over', '', 'next', '', 'here']})
print(test)
print('-------------------------------')
test = pd.get_dummies(test, dummy_na=True)
print(test)
test = test*1
print(test)
print('++++++++++  test trans to tensor  +++++++++++')
# test1 = torch.tensor(test)
# 全部转化
test1 = torch.tensor(test.values, dtype=torch.float32)
print(test1.shape)
print(test1)
print('-------------------------------')
# 不用iloc的话就是光是行处理
test2 = torch.tensor(test[:3].values, dtype=torch.float32)
print(test2.shape)
print(test2)
print('-------------------------------')
# 特定行列转化需要熟练运动iloc
test3 = torch.tensor(test.iloc[:2, :-1].values, dtype=torch.float32)
print(test3.shape)
print(test3)
input()output-begin:
(1460, 81)
(1459, 80)Id  MSSubClass MSZoning  LotFrontage SaleType SaleCondition  SalePrice
0   1          60       RL         65.0       WD        Normal     208500
1   2          20       RL         80.0       WD        Normal     181500
2   3          60       RL         68.0       WD        Normal     223500
3   4          70       RL         60.0       WD       Abnorml     140000
-----------------------------------------------MSSubClass MSZoning  LotFrontage  LotArea  YrSold SaleType SaleCondition
0          60       RL         65.0     8450    2008       WD        Normal
1          20       RL         80.0     9600    2007       WD        Normal
2          60       RL         68.0    11250    2008       WD        Normal
3          70       RL         60.0     9550    2006       WD       Abnorml
++++++++++  demo test dummies  +++++++++++“x” seasion
0    1    here
1    2    over
2    3        
3    4    next
4    5        
5    6    here
-------------------------------“x”  seasion_  seasion_here  seasion_next  seasion_over  seasion_nan
0    1     False          True         False         False        False
1    2     False         False         False          True        False
2    3      True         False         False         False        False
3    4     False         False          True         False        False
4    5      True         False         False         False        False
5    6     False          True         False         False        False“x”  seasion_  seasion_here  seasion_next  seasion_over  seasion_nan
0    1         0             1             0             0            0
1    2         0             0             0             1            0
2    3         1             0             0             0            0
3    4         0             0             1             0            0
4    5         1             0             0             0            0
5    6         0             1             0             0            0
++++++++++  test trans to tensor  +++++++++++
torch.Size([6, 6])
tensor([[1., 0., 1., 0., 0., 0.],[2., 0., 0., 0., 1., 0.],[3., 1., 0., 0., 0., 0.],[4., 0., 0., 1., 0., 0.],[5., 1., 0., 0., 0., 0.],[6., 0., 1., 0., 0., 0.]])
-------------------------------
torch.Size([3, 6])
tensor([[1., 0., 1., 0., 0., 0.],[2., 0., 0., 0., 1., 0.],[3., 1., 0., 0., 0., 0.]])
-------------------------------
torch.Size([2, 5])
tensor([[1., 0., 1., 0., 0.],[2., 0., 0., 0., 1.]])
output-end

相关的算子

concat — 合并.
iloc — 筛选行列.
apply — 处理列数据.
fillna — 填补数值空缺.
get_dummies — 独热编码(自行测试显示)

PS: 略。

http://www.dt0577.cn/news/38874.html

相关文章:

  • 上海人才引进网站关键词seo培训
  • 全国楼市走势最新消息seo招聘要求
  • 网站链接用处免费找客源软件
  • 陕西安康网站建设陕西网站seo
  • ps做素材下载网站有哪些百度客服24小时人工服务在线咨询
  • 济南兼职做网站南京seo代理
  • 做网站公司排名多少钱营口建网站的公司
  • 深圳 学习网站正安县网站seo优化排名
  • 用html做音乐网站网站如何进行seo
  • 网站建站网站80s隐秘而伟大友情链接怎么交换
  • 网站404 模板营销方案的几个要素
  • 网站的目标seo快速优化报价
  • 网站推广策划包含的内容做网站推广的公司
  • 网站建设向上滚动代码深圳网站优化哪家好
  • 哪些网站做机票酒店有优势如何做网络推广赚钱
  • 做玩网站怎么上传图片抖音关键词挖掘工具
  • 网站及备案b站免费版入口
  • 2017网站建设报价方案seo下载站
  • 大流量网站开发谷歌排名规则
  • 网站建设山东聚搜网络b信息流优化师职业规划
  • 建设银行交党费网站成功的网络营销案例及分析
  • 公司改名字重新备案网站会停吗如何设置友情链接
  • 企业没有网站怎么做seo优化百度竞价排名怎么收费
  • 建交友网站今日早间新闻
  • 用flash做的网站有哪些网址检测
  • 网站备案跟网安备案区别产品宣传推广方式有哪些
  • 武汉网站建设公司哪家比较好it培训机构有哪些
  • 吉林省建设厅门户网站有什么推广软件
  • 网站建设制作确认单个人如何在百度做广告
  • 微信营销推广方案苏州网站关键词优化推广