Hi so I'm a bit stuck with this problem. I've got a csv file, which looks something like this:
[12 34 45 22 3 5
34 33 2 67 5 55
2 90 88 12 34]
[245 4 13]
[33 90 50 22 90 1
23 44 876 10 7] ...
And so on. In other words, the csv file is split into lists of numbers separated either by a single space or double spaces and if the list of numbers exceeds a certain number of values (14 in my case), it continues the list on the next line until the list of numbers end. The lists of numbers are not separated by commas, but each new list begins and ends with the square brackets.
I want to import the csv file into a list of lists, which would look like this:
[[12, 34, 45, 22, 3, 5, 34, 33, 2, 67, 5, 55, 2, 90, 88, 12, 34],
[245, 4, 13],
[33, 90, 50, 22, 90, 1, 23, 44, 876, 10, 7],
[...]]
How could I achieve this? I've tried np.loadtxt and pandas, but both treat every line as its own observation.
Thanks in advance!
Edit: The numbers are actually separated either by a single space or double spaces.