How to change array to not array?

136 Views Asked by At

I used df.loc[(conditions),'col'].values to retrieve 2 separate cell values. I compared these two values with a min function and retrieved the minimum. the issue comes in when the minimum is used to insert into a list. The value shows up as an array. I'm using these collected values to create a df later, does it matter that they are an array? Also what is the type I would change the retrieved values to if I didn't want an array, but instead just a single object.

1

There are 1 best solutions below

0
On

The result of the min function should be of a number type. When you add that to a list, it should be in the list as a number as well:

a = list()
a.append(the_min_from_above)

print(a) should now show [the_min_from_above]

If you add more values, it becomes like this: [value1, value2, value3, ..., valueN]

This can be added to a DataFrame later, if necessary.