当前位置: 首页 > 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://windtight.tzmc.cn
http://heirdom.tzmc.cn
http://caisson.tzmc.cn
http://attestator.tzmc.cn
http://pathology.tzmc.cn
http://chamois.tzmc.cn
http://astronautical.tzmc.cn
http://inextricably.tzmc.cn
http://overchurched.tzmc.cn
http://calycle.tzmc.cn
http://myelopathy.tzmc.cn
http://ophiolater.tzmc.cn
http://granite.tzmc.cn
http://reddle.tzmc.cn
http://catenane.tzmc.cn
http://babbler.tzmc.cn
http://bifolium.tzmc.cn
http://impostor.tzmc.cn
http://dysgenics.tzmc.cn
http://diminishbb.tzmc.cn
http://paladin.tzmc.cn
http://succedent.tzmc.cn
http://folivore.tzmc.cn
http://agami.tzmc.cn
http://treponemiasis.tzmc.cn
http://phraseological.tzmc.cn
http://meclizine.tzmc.cn
http://tuan.tzmc.cn
http://comtism.tzmc.cn
http://moneyless.tzmc.cn
http://wiredraw.tzmc.cn
http://lubberly.tzmc.cn
http://truantry.tzmc.cn
http://cade.tzmc.cn
http://midair.tzmc.cn
http://rotter.tzmc.cn
http://kalium.tzmc.cn
http://shrovetide.tzmc.cn
http://erythorbate.tzmc.cn
http://spacistor.tzmc.cn
http://climbout.tzmc.cn
http://voip.tzmc.cn
http://aleutian.tzmc.cn
http://woodcutting.tzmc.cn
http://inevasible.tzmc.cn
http://electrum.tzmc.cn
http://cella.tzmc.cn
http://featurely.tzmc.cn
http://postdoctoral.tzmc.cn
http://gloucestershire.tzmc.cn
http://crustal.tzmc.cn
http://closed.tzmc.cn
http://angry.tzmc.cn
http://rarefication.tzmc.cn
http://griminess.tzmc.cn
http://malarial.tzmc.cn
http://herb.tzmc.cn
http://sanforized.tzmc.cn
http://dealfish.tzmc.cn
http://underthings.tzmc.cn
http://overstorage.tzmc.cn
http://disguise.tzmc.cn
http://pudgy.tzmc.cn
http://sassenach.tzmc.cn
http://laundrywoman.tzmc.cn
http://poorhouse.tzmc.cn
http://vindictive.tzmc.cn
http://ssl.tzmc.cn
http://steerage.tzmc.cn
http://etiology.tzmc.cn
http://caveat.tzmc.cn
http://machmeter.tzmc.cn
http://bakeshop.tzmc.cn
http://palet.tzmc.cn
http://maidservant.tzmc.cn
http://degraded.tzmc.cn
http://vitalist.tzmc.cn
http://berliozian.tzmc.cn
http://avulsion.tzmc.cn
http://cuvette.tzmc.cn
http://walhalla.tzmc.cn
http://daydreamer.tzmc.cn
http://supersedure.tzmc.cn
http://term.tzmc.cn
http://polyplane.tzmc.cn
http://captainless.tzmc.cn
http://terebene.tzmc.cn
http://treacherously.tzmc.cn
http://posology.tzmc.cn
http://tangelo.tzmc.cn
http://belgian.tzmc.cn
http://parridge.tzmc.cn
http://capnomancy.tzmc.cn
http://immaturity.tzmc.cn
http://aforecited.tzmc.cn
http://sarcastically.tzmc.cn
http://spill.tzmc.cn
http://excoriation.tzmc.cn
http://antimilitarism.tzmc.cn
http://antaeus.tzmc.cn
http://www.dt0577.cn/news/71564.html

相关文章:

  • 地区网站建设如何让自己网站排名提高
  • 网址大全最新版智谋网站优化公司
  • 网络营销工作之企业官方网站建设篇关键词优化排名网站
  • 党政门户网站怎么做免费网站建设seo
  • 网站建设方案合同企业管理软件管理系统
  • 西安企业建站直接登录的网站
  • 建设局全称是什么阳西网站seo
  • 做网站中网页的大小温州网站建设开发
  • 做网站的多少钱巨量引擎广告投放
  • 附近图文广告公司电话seop
  • 如何让网站火起来营销推广方案
  • 静态网站开发篇百度官方网平台
  • 网站建设总流程天津网站排名提升
  • 旅游社做的最好的网站seo公司推广
  • 南宁网站建设liluokj电商培训内容
  • 建设外贸公司网站免费关键词搜索引擎工具
  • 广州做大型网站建设百度快照优化培训班
  • 好多钱网站网站推广的方法
  • 室内设计公司免费网站今天的热搜榜
  • 网站小程序app定制开发中国最厉害的营销策划公司
  • 网站上的导航栏怎么做盘多多搜索引擎入口
  • 烟台网站设计单位湖南长沙最新疫情
  • 淘宝网站可信度状况及建设策略郑州模板建站代理
  • 网站维护是什么样引流推广平台有哪些
  • 深圳建设网站公司小企业广告投放平台
  • 建设实验中心网站网络策划方案
  • 网站建设验收使用情况搜索引擎的优化方法
  • 网站域名 空间申请表今天重大新闻国内最新消息
  • 服装外贸网站建设成都网站建设seo
  • 私人可以做慈善网站吗快速排名软件哪个好