The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Test16165165165
By Guest on 9th June 2018 09:06:39 PM | Syntax: PYTHON | Views: 21



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Thu Mar 15 04:18:20 2018
  5.  
  6. @author: sadievrenseker
  7. """
  8.  
  9. #kutuphaneler
  10.  
  11. import pandas as pd
  12. import numpy as np
  13. import matplotlib.pyplot as plt
  14.  
  15.  
  16.  
  17.  
  18. #kodlar
  19. #veri yukleme
  20.  
  21. veriler = pd.read_csv('eksikveriler.csv')
  22. #pd.read_csv("veriler.csv")
  23.  
  24. print(veriler)
  25.  
  26. #veri on isleme
  27. boy = veriler[['boy']]
  28. print(boy)
  29.  
  30. boykilo = veriler[['boy','kilo']]
  31. print(boykilo)
  32.  
  33. x = 10
  34.  
  35. class insan:
  36.     boy = 180
  37.     def kosmak(self,b):
  38.         return b + 10
  39.  
  40. ali = insan()
  41. print(ali.boy)
  42. print(ali.kosmak(90))
  43.  
  44.  
  45. #eksik veriler
  46. #sci - kit learn
  47. from sklearn.preprocessing import Imputer
  48.  
  49. imputer= Imputer(missing_values='NaN', strategy = 'mean', axis=0 )    
  50.  
  51. Yas = veriler.iloc[:,1:4].values
  52. print(Yas)
  53. imputer = imputer.fit(Yas[:,1:4])
  54. Yas[:,1:4] = imputer.transform(Yas[:,1:4])
  55. print(Yas)
  56.  
  57. ulke = veriler.iloc[:,0:1].values
  58. print(ulke)
  59. from sklearn.preprocessing import LabelEncoder
  60. le = LabelEncoder()
  61. ulke[:,0] = le.fit_transform(ulke[:,0])
  62. print(ulke)
  63. from sklearn.preprocessing import OneHotEncoder
  64. ohe = OneHotEncoder(categorical_features="all")
  65. ulke=ohe.fit_transform(ulke).toarray()
  66. print(ulke)
  67.    
  68. sonuc = pd.DataFrame(data = ulke,index = range(22), columns = ['fr','tr','us'])
  69. print(sonuc)
  70.    
  71. sonuc2 = pd.DataFrame(data = Yas, index = range(22), columns = ['boy','kilo','yas'])
  72. print(sonuc2)
  73.  
  74. cinsiyet = veriler.iloc[:,-1:].values
  75. print(cinsiyet)
  76.  
  77. sonuc3 = pd.DataFrame(data = cinsiyet , index = range(22) , columns = ['cinsiyet'])
  78. print(sonuc3)
  79.  
  80. sonuclar=pd.concat([sonuc,sonuc2],axis=1)
  81. print(sonuclar)
  82.  
  83. s2=pd.concat([sonuclar,sonuc3],axis=1)
  84. print(s2)



  • Recent Pastes
  • Test
    2 days 2 hours 55 mins 49 secs ago
  • Kokpok
    1 week 1 day 17 hours 38 mins and 15 secs ago
  • Test16165165165
    1 week 3 days 4 hours 36 mins and 24 secs ago
  • Testing the features
    1 week 6 days 16 mins and 46 secs ago
  • Ryty
    1 week 6 days 7 hours 9 mins and 10 secs ago