#๐Ÿ”’ I'm not getting the results I want

10 messages ยท Page 1 of 1 (latest)

bleak locust
#

I am outputting data from a csv file incorrectly

peak owlBOT
#

@bleak locust

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

bleak locust
#
import pandas as pd
import numpy as np
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import LabelEncoder, OneHotEncoder


# Kodlar



# Veri Yรผkleme

veriler = pd.read_csv('D:\\Project\\eksikVeriler.csv')
print(veriler)


ulke = veriler.iloc[:, 0:1].values
print(ulke)

from sklearn import preprocessing

le = preprocessing.LabelEncoder()

ulke[:,0] = le.fit_transform(veriler.iloc[:,0])

print(ulke)

ohe = preprocessing.OneHotEncoder()
ulke = ohe.fit_transform(ulke).toarray()
print(ulke)

print(list(range(22)))
sonuc = pd.DataFrame(data=ulke, index=range(22), columns=['fr', 'tr', 'us',''])
print(sonuc)

sonuc2 = pd.DataFrame(data=ulke, index=range(22), columns=['boy', 'kilo', 'yas',''])
print(sonuc2)

cinsiyet = veriler.iloc[:,-1].values
print(cinsiyet)

sonuc3 = pd.DataFrame(data=ulke, index=range(22), columns=['cinsiyet','','',''])
print(sonuc3)

s=pd.concat([sonuc, sonuc2], axis=1)
print(s)

s2=pd.concat([s, sonuc3], axis=1)
print(s2)
#
ulke,boy,kilo,yas,cinsiyet
tr,130,30,10,e 
tr,125,36,11,e 
tr,135,34,10,k 
tr,133,30,9,k 
tr,129,38,12,e 
tr,180,90,30,e 
tr,190,80,25,e 
tr,175,90,35,e 
tr,177,60,22,k 
us,185,105,33,e 
us,165,55,27,k 
us,155,50,44,k 
us,160,58,39,k 
Us,162,59,41,k 
us,167,62,55,k 
fr,174,70,47,e 
fr,193,90,23,e 
fr,187,80,27,e 
fr,183,88,28,e 
fr,159,40,29,k 
fr,164,66,32,k 
fr,166,56,42,k 
#

look my project files

#
     fr   tr   us       boy  kilo  yas       cinsiyet               
0   0.0  1.0  0.0  0.0  0.0   1.0  0.0  0.0       0.0  1.0  0.0  0.0
1   0.0  1.0  0.0  0.0  0.0   1.0  0.0  0.0       0.0  1.0  0.0  0.0
2   0.0  1.0  0.0  0.0  0.0   1.0  0.0  0.0       0.0  1.0  0.0  0.0
3   0.0  1.0  0.0  0.0  0.0   1.0  0.0  0.0       0.0  1.0  0.0  0.0
4   0.0  1.0  0.0  0.0  0.0   1.0  0.0  0.0       0.0  1.0  0.0  0.0
5   0.0  1.0  0.0  0.0  0.0   1.0  0.0  0.0       0.0  1.0  0.0  0.0
6   0.0  1.0  0.0  0.0  0.0   1.0  0.0  0.0       0.0  1.0  0.0  0.0
7   0.0  1.0  0.0  0.0  0.0   1.0  0.0  0.0       0.0  1.0  0.0  0.0
8   0.0  1.0  0.0  0.0  0.0   1.0  0.0  0.0       0.0  1.0  0.0  0.0
9   0.0  0.0  1.0  0.0  0.0   0.0  1.0  0.0       0.0  0.0  1.0  0.0
10  0.0  0.0  1.0  0.0  0.0   0.0  1.0  0.0       0.0  0.0  1.0  0.0
11  0.0  0.0  1.0  0.0  0.0   0.0  1.0  0.0       0.0  0.0  1.0  0.0
12  0.0  0.0  1.0  0.0  0.0   0.0  1.0  0.0       0.0  0.0  1.0  0.0
13  0.0  0.0  1.0  0.0  0.0   0.0  1.0  0.0       0.0  0.0  1.0  0.0
14  0.0  0.0  1.0  0.0  0.0   0.0  1.0  0.0       0.0  0.0  1.0  0.0
15  0.0  0.0  0.0  1.0  0.0   0.0  0.0  1.0       0.0  0.0  0.0  1.0
16  1.0  0.0  0.0  0.0  1.0   0.0  0.0  0.0       1.0  0.0  0.0  0.0
17  1.0  0.0  0.0  0.0  1.0   0.0  0.0  0.0       1.0  0.0  0.0  0.0
18  1.0  0.0  0.0  0.0  1.0   0.0  0.0  0.0       1.0  0.0  0.0  0.0
19  1.0  0.0  0.0  0.0  1.0   0.0  0.0  0.0       1.0  0.0  0.0  0.0
20  1.0  0.0  0.0  0.0  1.0   0.0  0.0  0.0       1.0  0.0  0.0  0.0
21  1.0  0.0  0.0  0.0  1.0   0.0  0.0  0.0       1.0  0.0  0.0  0.0
bleak locust
#

Why are my results like this

peak owlBOT
#

@bleak locust

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.