Reputation: 175
With regard to a data import on which I have to do simple operations, I encounter the following error with the iloc function. What can I do? Thanks
List_of_X=pd.read_csv('List_of_X.csv')
def main_function(self, i, j, test1, test2, test3, test4=None, test5=None, data_type=None):
for x in range(0, len(self.List_of_X)):
old_values_X = self.old_X()[i]
new_values_X = self.List_of_X.iloc[x][1].astype('float')[j]
IndexError: invalid index to scalar variable (on new_values_X line)
I report the data sample:
name | X | Y |
red |1.5| 2 |
yellow |5 | 3 |
blue |3 | 4 |
Upvotes: 0
Views: 204
Reputation: 175
The solution was to change the second declaration as:
new_values_X = self.List_of_X.iloc[x][1].astype('float')
was not a value indexable
Upvotes: 1