I have a large .csv database with a column name VELOCITY containing 3D velocity vectors.
Each element of the VELOCITY column has the form: '(v1, v2, v3)'
To read the data I used:
df = pd.read_csv('database.csv')
df = pd.DataFrame(df)
Now, I tried to define a velocity_array, where every element is 3D velocity vector.
velocity_array = np.asarray(df['VELOCITY'])
and I get something like this:
['(a1, a2, a3)',
'(b1, b2, b3)',
'(c1, c2, c3)',
.
.
.
'(z1, z2, z3)']
which is not what I need. I need to have an array of 3D-velocity-arrays. Something like this:
[[a1, a2, a3],
[b1, b2, b3],
[c1, c2, c3],
.
.
.
[z1, z2, z3]]
so that I could recover a 3D-velocity-array only by calling velocity_array[i] .
Appreciate any help, thanks!
#=====
Just adding (as requested):
df.head() looks like this:
SC_VELOCITY EVENT_ID
0 (-7143.645, -825.2191, -2463.361) 388161
1 (-7143.645, -825.2191, -2463.361) 400028
2 (-7087.896, -1058.8871, -2533.3374) 415847
3 (-7024.463, -1291.3812, -2600.547) 527126
4 (-6953.418, -1522.4622, -2664.9265) 605939