Reputation: 359
I have the following portion of my code below.
self.result_rows=summer17.index[summer17['Company'].str.contains(self.searche1_value.get(),na=False,case=False)]
self.c0=0
print(summer17.iloc[self.result_rows,self.c0])
and the output is
0 CAPS
Name: Company, dtype: object
What I am trying to do is to pass the value (in this case CAPS) from that specific cell into the variable results_rows. THe problem is what I'm getting in return is a bunch of data about the dataframe that I don't want.
Upvotes: 0
Views: 58
Reputation: 30605
You are passing the row_indexer parameter as a an array so iloc
method returns a series( which contains data about the dataframe). If you want the values you use values accessor i.e print(summer17.iloc[self.result_rows,self.c0].values)
Example Dataframe :
df = pd.DataFrame([[0,1,2,3,5,6],[1,3,5,7,9,11]])
df.iloc[[0],0]
Output:
0 0 Name: 0, dtype: int64
So with values accessor i.e df.iloc[[0],0].values
Output:
array([0])
Upvotes: 1