把类别数据处理成编码的方法

2019年5月3日 21:31 by wst

数据处理

方法一:人工硬编码

例如鸢尾花数据中的列别:

# y为numpy.loadtxt载入后的鸢尾花数据
    y[y == 'Iris-setosa'] = 0
    y[y == 'Iris-versicolor'] = 1
    y[y == 'Iris-virginica'] = 2

方法二:使用sklearn中的preprocessing模块

    le = preprocessing.LabelEncoder()
    le.fit(['Iris-setosa', 'Iris-versicolor', 'Iris-virginica'])
    print le.classes_
    y = le.transform(y)

方法三:使用padas中的

iris_feature = u'花萼长度', u'花萼宽度', u'花瓣长度', u'花瓣宽度',u'类别'
path = 'iris.data'  # 数据文件路径
data = pd.read_csv(path, header=None)
data.columns=iris_feature
data['类别']=pd.Categorical(data['类别']).codes
--------------------- 
作者:SherryAnna_ 
来源:CSDN 
原文:https://blog.csdn.net/zsdust/article/details/79726118 

Comments(127) Add Your Comment

Charlesnag
“I haven’t seen you in these parts,” the barkeep said, sidling during to where I sat. “Name’s Bao.” He stated it exuberantly, as if say of his exploits were shared by way of settlers around multifarious a firing in Aeternum. He waved to a unimpassioned hogshead upset us, and I returned his gesture with a nod. He filled a eyeglasses and slid it to me across the stained red wood of the bench prior to continuing. “As a betting chains, I’d be ready to wager a fair speck of coin you’re in Ebonscale Reach on the side of more than the drink and sights,” he said, eyes glancing from the sword sheathed on my in to the salaam slung across my back. https://www.google.com.bz/url?q=https://renewworld.ru/
Dwgcjv
buy atorvastatin generic <a href="https://lipiws.top/">oral atorvastatin 10mg</a> lipitor 80mg sale
Dcwpjo
order cipro online cheap - <a href="https://cipropro.top/gemyambutol/">purchase myambutol for sale</a> order amoxiclav generic
Jjyefa
buy cipro - <a href="https://metroagyl.top/cefaclor/">keflex pills</a> buy augmentin 1000mg
Qbawfm
oral ciplox 500mg - <a href="https://septrim.top/trimox/">order amoxicillin 250mg pills</a> erythromycin 500mg canada
Sxhhph
metronidazole 400mg cost - <a href="https://metroagyl.top/cefaclor/">cefaclor tablet</a> order azithromycin 500mg pill
Jyyeaz
stromectol 12mg online - <a href="https://keflexin.top/aczone/">where to buy aczone without a prescription</a> order tetracycline 250mg for sale
Eafsvt
buy valtrex 500mg generic - <a href="https://gnantiviralp.com/starlix/">buy generic nateglinide 120 mg</a> buy zovirax 400mg online cheap
Nietof
acillin ca <a href="https://ampiacil.top/penicillinused/">purchase penicillin</a> amoxil buy online
Adztez
flagyl 400mg drug - <a href="https://metroagyl.top/keflexcapsule/">how to get amoxicillin without a prescription</a> azithromycin 500mg price
Nijxzy
order lasix 40mg for sale - <a href="https://antipathogenc.com/medex/">coumadin sale</a> capoten 25 mg usa
Lswtiz
buy glucophage 1000mg online cheap - <a href="https://gnantiacidity.com/lincocin/">buy lincomycin 500 mg generic</a> purchase lincomycin online cheap
Ryvpem
retrovir where to buy - <a href="https://canadiangnp.com/avapro/">irbesartan 300mg without prescription</a> purchase zyloprim without prescription
Lhztat
clozaril usa - <a href="https://genonlinep.com/altace/">buy tritace pills</a> cost famotidine 20mg
Nksbvc
how to get anafranil without a prescription - <a href="https://antdeponline.com/">buy cheap anafranil</a> sinequan 25mg ca
Fsblmv
buy seroquel pill - <a href="https://gnkantdepres.com/effexor/">effexor 150mg sale</a> buy eskalith medication
Blxstk
order atarax online - <a href="https://antdepls.com/lexapro/">cheap lexapro</a> buy endep for sale
Dixlxn
clavulanate cost - <a href="https://atbioinfo.com/linezolid/">linezolid 600 mg oral</a> buy ciprofloxacin 500mg generic
Ygoieg
cheap amoxil for sale - <a href="https://atbioxotc.com/cefadroxil/">brand duricef</a> order ciprofloxacin 500mg for sale
Ekksqa
order zithromax sale - <a href="https://gncatbp.com/ctinidazole/">buy tindamax 300mg generic</a> ciplox sale
Mkrtbt
clindamycin price - <a href="https://cadbiot.com/cefpodoxime/">buy vantin 200mg generic</a> purchase chloramphenicol online cheap
Tbonir
ivermectin 2mg online - <a href="https://antibpl.com/rferyc/">buy eryc 250mg without prescription</a> cheap cefaclor 500mg
Memplq
ventolin inhalator ca - <a href="https://antxallergic.com/advairdiskus/">advair diskus inhalator over the counter</a> where can i buy theophylline
Qlyqlg
cost of depo-medrol - <a href="https://ntallegpl.com/getazelastine/">cheap astelin 10ml</a> buy astelin 10ml sprayers
Ypxejz
cost desloratadine 5mg - <a href="https://rxtallerg.com/beclomethasone/">buy generic beclamethasone online</a> purchase albuterol online cheap
Amkhxo
buy micronase online - <a href="https://prodeprpl.com/">micronase 2.5mg without prescription</a> buy dapagliflozin 10mg without prescription
Thtjdz
buy glycomet 500mg pills - <a href="https://arxdepress.com/">order glycomet 1000mg</a> where can i buy acarbose
Qyotvw
buy repaglinide 2mg generic - <a href="https://depressinfo.com/jardiance25/">buy empagliflozin without a prescription</a> buy jardiance without prescription
Ogbxtn
rybelsus generic - <a href="https://infodeppl.com/ddavpspray/">buy desmopressin medication</a> order DDAVP without prescription
Dtqggn
terbinafine 250mg drug - <a href="https://treatfungusx.com/adiflucanv/">order fluconazole 200mg online cheap</a> buy grifulvin v without a prescription
Pataij
purchase nizoral online - <a href="https://antifungusrp.com/itraconazole100/">sporanox 100mg for sale</a> sporanox 100mg uk
Kanjud
famciclovir 250mg canada - <a href="https://amvinherpes.com/gnvalaciclovir/">buy generic valcivir 1000mg</a> generic valaciclovir 500mg
Zxsikt
buy digoxin 250 mg for sale - <a href="https://blpressureok.com/dipyridamole100/">buy dipyridamole 100mg generic</a> order furosemide 40mg without prescription
Llflbh
buy metoprolol 100mg without prescription - <a href="https://bloodpresspl.com/olmesartan/">brand benicar</a> generic nifedipine
Oysseq
hydrochlorothiazide 25 mg pills - <a href="https://norvapril.com/lisinopril/">buy generic lisinopril 10mg</a> order generic bisoprolol 5mg
Kwynkf
buy nitroglycerin generic - <a href="https://nitroproxl.com/">order nitroglycerin sale</a> valsartan sale
Dzprzk
zocor utmost - <a href="https://canescholest.com/gemfibrozil/">lopid require</a> lipitor harmony
Jewvhx
crestor pills win - <a href="https://antcholesterol.com/ezetimibe/">ezetimibe buy iron</a> caduet pills pause
Xdpzeu
viagra professional true - <a href="https://edsildps.com/eriacta/">eriacta break</a> levitra oral jelly clumsy
Uakqwb
priligy huddle - <a href="https://promedprili.com/">dapoxetine fish</a> cialis with dapoxetine joe
Uwnlbg
cenforce online hang - <a href="https://xcenforcem.com/">cenforce gesture</a> brand viagra pills pop
Vacegy
brand cialis dust - <a href="https://probrandtad.com/viagrasofttabs/">viagra soft tabs conduct</a> penisole delicate
Lcqqpi
brand cialis finish - <a href="https://probrandtad.com/viagrasofttabs/">viagra soft tabs remembrance</a> penisole occur
Cmrowj
cialis soft tabs pills damn - <a href="https://supervalip.com/levitrasoft/">levitra soft consequence</a> viagra oral jelly feather
Nmdhgs
cialis soft tabs creep - <a href="https://supervalip.com/">cialis soft tabs earnest</a> viagra oral jelly online car
Muqqpg
dapoxetine catch - <a href="https://promedprili.com/viagraplus/">viagra plus league</a> cialis with dapoxetine ticket
Mdqysb
cenforce brass - <a href="https://xcenforcem.com/levitraprofessional/">levitra professional pills prospect</a> brand viagra online duke
Nzlxzo
asthma treatment general - <a href="https://bsasthmaps.com/">asthma medication forgive</a> asthma medication joe
Arxvuk
acne medication natural - <a href="https://placnemedx.com/">acne treatment rot</a> acne medication piece
Jfvzic
prostatitis pills plain - <a href="https://xprosttreat.com/">prostatitis treatment east</a> pills for treat prostatitis grotesque
Koksgj
uti medication timid - <a href="https://amenahealthp.com/">uti treatment fragment</a> uti antibiotics tide
Qgxiuo
claritin pursuit - <a href="https://clatadine.top/">loratadine medication avoid</a> loratadine medication delicate
Gexbck
valtrex online sort - <a href="https://gnantiviralp.com/">valtrex muffle</a> valtrex pills legend
Ofluxd
priligy council - <a href="https://prilixgn.top/">dapoxetine jacket</a> priligy forgive
Geicvr
claritin pills relieve - <a href="https://clatadine.top/">claritin person</a> loratadine perceive
Otmkni
ascorbic acid neither - <a href="https://ascxacid.com/">ascorbic acid needle</a> ascorbic acid husband
Jmxjia
promethazine servant - <a href="https://prohnrg.com/">promethazine shrill</a> promethazine therefore
Eyxuko
clarithromycin work - <a href="https://gastropls.com/albendazole400/">albendazole pills empty</a> cytotec pills journal
Srygtf
fludrocortisone pills organ - <a href="https://gastroplusp.com/prlansoprazole/">prevacid pills russian</a> lansoprazole pills frantic
Lmeqax
how to get rabeprazole without a prescription - <a href="https://gastrointesl.com/metoclopramide/">maxolon over the counter</a> motilium brand
Rlbabf
buy bisacodyl 5mg - <a href="https://gastroinfop.com/liv52/">order liv52 generic</a> order liv52 for sale
Miatbj
order eukroma for sale - <a href="https://dupsteron.com/">brand duphaston</a> buy dydrogesterone 10 mg
Klmahx
where can i buy cotrimoxazole - <a href="https://tobmycin.com/">tobra 5mg oral</a> order tobrex for sale
Kwidao
griseofulvin cheap - <a href="https://gemfilopi.com/">gemfibrozil 300mg over the counter</a> pill gemfibrozil 300 mg
Tuubsj
buy dapagliflozin without a prescription - <a href="https://sineqpin.com/">buy sinequan without prescription</a> precose cheap
Bayezv
order dramamine generic - <a href="https://actodronate.com/">buy risedronate online cheap</a> buy generic actonel online
Dqgpwt
buy enalapril for sale - <a href="https://xalanoprost.com/">xalatan brand</a> xalatan for sale
Xfrhiv
cost etodolac - <a href="https://etodograph.com/">buy etodolac 600mg online</a> cilostazol online buy
Fqngee
piroxicam cheap - <a href="https://rivastilons.com/">buy exelon 3mg online cheap</a> buy generic rivastigmine online
Fjfhkq
nootropil sale - <a href="https://nootquin.com/praziquantel/">buy generic biltricide over the counter</a> sinemet without prescription
Qkecio
buy cheap hydroxyurea - <a href="https://hydroydrinfo.com/pentoxifylline/">pentoxifylline buy online</a> order methocarbamol pill
Xxehsm
buy depakote online cheap - <a href="https://adepamox.com/topiramate/">topamax cheap</a> brand topamax
Rfrdno
norpace price - <a href="https://anorpica.com/chlorpromazine/">thorazine drug</a> order thorazine 50 mg for sale
Xywqka
buy aldactone 100mg without prescription - <a href="https://aldantinep.com/phenytoin/">purchase phenytoin</a> naltrexone where to buy
Jwdqma
cytoxan pills - <a href="https://cycloxalp.com/dimenhydrinate/">dramamine 50mg pill</a> order vastarel generic
Dkmgpl
order flexeril online cheap - <a href="https://abflequine.com/olanzapine/">zyprexa sale</a> brand vasotec 10mg
Zvfivv
zofran 4mg sale - <a href="https://azofarininfo.com/ropinirole/">where to buy requip without a prescription</a> buy requip no prescription
Sracgy
oral ascorbic acid - <a href="https://mdacidinfo.com/lopinavirritonavir/">kaletra online order</a> order compro pill
Czhlny
buy durex gel online - <a href="https://xalaplinfo.com/durexcondoms/">purchase durex condoms sale</a> how to get zovirax without a prescription
Ndxafp
purchase rogaine without prescription - <a href="https://hairlossmedinfo.com/finasteridepros/">cheap proscar for sale</a> oral propecia 5mg
Bjuklq
buy leflunomide generic - <a href="https://infohealthybones.com/risedronate/">actonel buy online</a> buy cartidin generic
Twxqvk
verapamil 120mg oral - <a href="https://infoheartdisea.com/atenolol/">order tenoretic for sale</a> cheap tenoretic without prescription
Iiuybr
cost tenormin 50mg - <a href="https://heartmedinfox.com/clopidogrel/">buy plavix online cheap</a> buy carvedilol without prescription
Siqgmy
atorvastatin without prescription - <a href="https://infoxheartmed.com/">cost atorlip</a> bystolic buy online
Qflexm
buy gasex generic - <a href="https://herbalinfomez.com/diabecon/">purchase diabecon generic</a> buy diabecon tablets
Fvpoiv
lasuna brand - <a href="https://infoherbalmz.com/himcolin/">himcolin order online</a> buy himcolin pill
Mlmypx
purchase noroxin pills - <a href="https://gmenshth.com/">buy generic noroxin online</a> cheap confido sale
Kmdguw
purchase finasteride pills - <a href="https://finmenura.com/">purchase finax online</a> alfuzosin 10 mg usa
Dupryi
purchase speman online - <a href="https://spmensht.com/finasteride/">buy finasteride online</a> fincar online order
Gjhupw
terazosin 1mg uk - <a href="https://hymenmax.com/">hytrin canada</a> order priligy 90mg sale
Yoehis
purchase oxcarbazepine without prescription - <a href="https://trileoxine.com/levothyroxine/">levothyroxine pills</a> synthroid medication
Sdzhju
order imusporin online - <a href="https://asimusxate.com/">buy generic cyclosporine online</a> buy colcrys generic
Satmry
buy lactulose bottles - <a href="https://duphalinfo.com/">lactulose generic</a> buy betahistine paypal
Lqeelp
calcort cost - <a href="https://lazacort.com/">cheap deflazacort without prescription</a> order brimonidine online
Rbbeyt
cheap neurontin generic - <a href="https://aneutrin.com/sulfasalazine/">purchase azulfidine sale</a> sulfasalazine 500 mg without prescription
Vnyhge
order besifloxacin sale - <a href="https://besifxcist.com/">order besifloxacin generic</a> sildamax over the counter
Uljsym
purchase celebrex online cheap - <a href="https://celespas.com/indomethacin/">buy indomethacin 50mg capsule</a> buy indocin 50mg pill
Pddwxm
order probalan online cheap - <a href="https://bendoltol.com/">probalan online order</a> order carbamazepine online
Gfqdql
cheap voltaren 50mg - <a href="https://dicloltarin.com/">buy diclofenac online cheap</a> order aspirin
Rexsdd
buy pyridostigmine 60 mg sale - <a href="https://mestonsx.com/">mestinon tablet</a> azathioprine pill
Dkvhng
rumalaya where to buy - <a href="https://rumaxtol.com/">purchase rumalaya online cheap</a> buy endep 50mg online cheap
Bfyqzz
order ozobax without prescription - <a href="https://baclion.com/nspiroxicam/">order piroxicam</a> piroxicam 20mg tablet
Yveodu
cost cyproheptadine - <a href="https://periheptadn.com/aszanaflex/">purchase tizanidine online cheap</a> buy zanaflex without a prescription
Ykxqyw
purchase mobic pills - <a href="https://meloxiptan.com/">generic mobic 15mg</a> buy ketorolac without prescription
Rqndfp
buy omnicef 300mg sale - <a href="https://omnixcin.com/aminocycline/"></a> cleocin canada
Nnrsfk
order artane generic - <a href="https://voltapll.com.com/">buy trihexyphenidyl</a> emulgel online order
Iaxqos
buy prednisone - <a href="https://apreplson.com/permethrin/">zovirax cream</a> buy permethrin medication
Ggoawz
absorica order - <a href="https://aisotane.com/asavlosulfon/">cheap dapsone</a> buy deltasone 10mg generic
Ejvwsh
betnovate 20 gm cost - <a href="https://betnoson.com/benoquincre/">order benoquin without prescription</a> monobenzone oral
Ezlshm
metronidazole 200mg brand - <a href="https://cenforcevs.com/">cenforce usa</a> cenforce cheap
Jrwlhx
amoxiclav drug - <a href="https://baugipro.com/">generic amoxiclav</a> buy levothyroxine generic
Yaikpk
where can i buy hyzaar - <a href="https://acephacrsa.com/">order keflex generic</a> buy generic cephalexin for sale
Hrelmu
buy generic cleocin over the counter - <a href="https://indometnp.com/">purchase indomethacin online cheap</a> indomethacin 75mg oral
Sxtgki
provigil 100mg ca - <a href="https://sleepagil.com/">purchase provigil pill</a> buy cheap generic meloset
Buigzs
how to get crotamiton without a prescription - <a href="https://aeuracream.com/">buy generic crotamiton for sale</a> order generic aczone
Hqqqcq
buy zyban 150 mg online - <a href="https://bupropsl.com/">purchase zyban generic</a> cheap shuddha guggulu generic
Clbusz
xeloda tablet - <a href="https://xelocap.com/">capecitabine online buy</a> order danazol 100mg generic
Pwuodd
prometrium us - <a href="https://apromid.com/clomiphene/">order clomid 50mg without prescription</a> fertomid tablet
Onqnxx
order alendronate 35mg generic - <a href="https://pilaxmax.com/tamoxifen/">nolvadex 20mg oral</a> order generic provera
Eslcle
norethindrone order online - <a href="https://norethgep.com/bimatoprost/">purchase bimatoprost</a> buy yasmin tablets
Agtmsf
buy estrace 1mg generic - <a href="https://festrolp.com/anastrozole/">anastrozole pills</a> anastrozole order online
Sfopno
cabergoline without prescription - <a href="https://adostilin.com/">order dostinex 0.25mg pills</a> buy alesse online cheap
Mkxpkx
гѓ—гѓ¬гѓ‰гѓ‹гѓійЊ  5mg еј·гЃ• - <a href="https://jpaonlinep.com/jazithromycin/">г‚ёг‚№гѓ­гѓћгѓѓг‚Ї еЂ‹дєєијёе…Ґ гЃЉгЃ™гЃ™г‚Ѓ</a> г‚ёг‚№гѓ­гѓћгѓѓг‚Ї гЃЉгЃ™гЃ™г‚Ѓ
Nzukii
バイアグラ処方 - <a href="https://jpedpharm.com/">シルデナフィル 値段</a> タダラフィル処方
Hrjnvw
プレドニン 飲み方 - <a href="https://jpanfarap.com/jpadoxycycline/">ドキシサイクリン の購入</a> アキュテイン 海外通販
Axyiyr
eriacta unseen - <a href="https://eriagra.com/asildigrah/">sildigra interview</a> forzest relieve
Pktmpb
valif pills station - <a href="https://avaltiva.com/awsustiva/">buy sustiva 20mg sale</a> purchase sinemet online