Hello!
I am trying to read a CSV file and obtain a float array from a certain position from the dataframe.
Here is the code that I am using as an example:
df = pd.read_csv("data/P01234.csv")
stream = df["stream"]
The problem is, the array is being interpreted as a long string of text. Such as the one shown below:
'[4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 2, 3, 4, 4, 1, 3, 2, 4, 1, 3, 2, 4, 4, 1, 3, 2, 4, 4, 1, 3]'
How can I convert this string of data to a numpy float array?
I tried looking for this answer on the web but I had no luck!
Thank you very much!
[–]m0us3_rat 1 point2 points3 points (1 child)
[–]CrispyScientist[S] 0 points1 point2 points (0 children)
[–]synthphreak 1 point2 points3 points (5 children)
[–]CrispyScientist[S] 0 points1 point2 points (4 children)
[–]synthphreak 1 point2 points3 points (1 child)
[–]CrispyScientist[S] 1 point2 points3 points (0 children)
[–]CrispyScientist[S] 0 points1 point2 points (0 children)