I'm trying to create a list in order to work the values that I get, but, when I use the
nums=pd.read_excel(excel, header=None)
and then
nums=np.asarray(nums)
The type of each value, becomes numpy.float64, so whenever I try to filter a value, based on the fact that it's a float, those values are not counted. Is there a way in which I can create a list/array from a column in excel and the value type doesn't get changed and it's actually read as a regular float? (I have tried including the type numpy.float64 in my filter, but the problem is that it includes ints from the excel, which I'm not supposed to use so it does not work)
Any help, thanks!
edit 1:
print(nums):
0
0 1.00
1 2.00
2 3.00
3 4.00
4 5.00
5 6.00
6 7.00
7 8.00
8 9.00
9 10.00
10 3.30
11 3.22
and my expected output would be 1,2,3, etc (int type, instead of numpy.float64 in which they are converted to)
<class 'numpy.float64'>
edit 2: If I were to print np.asarray(nums) it'd look like this:
[[ 1. ]
[ 2. ]
[ 3. ]
[ 4. ]
[ 5. ]
[ 6. ]
[ 7. ]
[ 8. ]
[ 9. ]
[10. ]
[ 3.3 ]
[ 3.22]]
The solution to your problem is more straightforward than what you're suggesting.
Numpy allows you to ask if a float (or float64) is an integer:
import numpy as np
a_row = np.array([1,2,3,4,5,3.3])
a_column = a_row.reshape(6,1)
print(a_row[4].is_integer())
print(a_row[5].is_integer())
print(a_column[4][0].is_integer())
print(a_column[5][0].is_integer())
Result:
True
False
True
False