0

i am using pandas in python to locate certain data in my CSV file using iloc. It is returning the data that i want but also returning data values that i don't want(The row numbers and column names).

[My Csv File is : ] [1]: https://i.stack.imgur.com/EsdoG.jpg

And my code is :

import pandas as pd

ctr_x = []
ctr_y =[]

obj = 'red_hat'
df = pd.read_csv('ring_1_05_sam.csv',)
ctr_x = df.iloc[10:12, 0:1 ]
ctr_y = df.iloc[10:12, 1:2]

print(ctr_x)
print(ctr_y)

The output that i get is :

version
10  1536.25
11  1536.50
     3
10  895.25
11  896.00

So i am also getting the Row numbers and column names along with my desired result. Any idea how i get rid of these row numbers and column names?

Shameendra
  • 163
  • 2
  • 3
  • 15

0 Answers0