My question is: I think the answer is no, but is there any way to fix some columns of a numpy array to be integer and the rest as float?
Why I'm asking:
I have a series of items, each is of the form (i, j, x, y z)
where i, j
are unique, non-recurring integer pairs and x, y, z
are floats. I need to keep them together and there are several ways to do it that will work, which includes but is not limited to
- a list of 5-tuples
- a dictionary where
i, j
is the key - or even as a pandas DataFrame
The following are true:
- Speed is not a critical concern
- the series does not need to be in any specific order or sorted
- integer values will be small, less than +/- 500
- total length will be small, less than 10,000 5-tuples
The way that is easiest for me to work with and manipulate them at the moment would be as an n x 5
numpy array, but with dtype
as np.float64 I am concerned that I can't always expect i
and j
to be integers and that may cause trouble down the line that I can't anticipate.