Take a string in the format:
data = ‘’’
1 4
2 8.2
3 12
4 15,16
’’’
and return the following list of numpy arrays:
[np,array([1, 2, 3, 4]),
np.array(4, 8.2, 12, 15.16)]
Example:
[ 0. -0.00499377 0. -0.03732585 0. ]
Using pandas
If we need a pandas dataframe instead, we can exploit the StringIO
method from the standard io
library: