I've been trying to do this for a while, with little success so far. I have a large (>400,000 data points) 2D array in python. The array itself could be split into a series of smaller rows based on the date (dd\mm\yyyy).
To achieve my end goal, one of the things I want to do is to change a numpy.ndarray (similar to as can be seen below, but obviously much larger) into a dictionary of keys (one for each day of the month) and corresponding arrays (consisting of all of the original array's data for each of the particular days).
[['16/06/2015 00:00' 'card' 'Smith' 'John' 'Full Time']
['16/06/2015 00:00' 'card' 'Doe' 'Jane' 'Part Time']
['17/07/2015 00:00' 'card' 'Doe' 'Jane' 'Part Time']
['18/06/2015 00:00' 'card' 'Smith' 'John' 'Full Time']
['30/06/2015 00:00' 'card' 'Bob' 'Roberts' 'Full Time']
['30/06/2015 00:00' 'card' 'Smith' 'John' 'Full Time']
['30/06/2015 00:00' 'card' 'Bob' 'Roberts' 'Full Time']]
I am not sure how to get the array above to appear in the same code format as the one I am importing, but as I mentioned, it should appear as a numpy.ndarray.
I have code, which you can see below, which returns the error "Index Error: Arrays used as indices must be of integer (or boolean) type", which is a problem as the data I have is made up of strings.
Array1 = np.genfromtxt('PATH', delimiter="\t", dtype=(str))
y = {}
for row in Array1:
v = Array1[row[1:]]
k = row[0]
y[k]=v
If you need any more information, please just ask and I will try to provide anything required. I am fairly novice to all this.
'16/06/2015 00:00' 'card' 'Smith' 'John' 'Full Time'evaluates to the single string'16/06/2015 00:00cardSmithJohnFull Time'. Is that taken into account?Array1 = np.genfromtxt(........