I have data in a list type format of NumPy arrays
[array([[ 0.00353654]]), array([[ 0.00353654]]), array([[ 0.00353654]]),
array([[ 0.00353654]]), array([[ 0.00353654]]), array([[ 0.00353654]]),
array([[ 0.00353654]]), array([[ 0.00353654]]), array([[ 0.00353654]]),
array([[ 0.00353654]]), array([[ 0.00353654]]), array([[ 0.00353654]]),
array([[ 0.00353654]])]
I am trying to get this into a polyfit function:
m1 = np.polyfit(x, y, deg=2)
But it is returning this error: TypeError: expected 1D vector for x
I am thinking that as of now, I need to do something like flatten my data into something like this:
[0.00353654, 0.00353654, 0.00353654, 0.00353654, 0.00353654, 0.00353654 ...]
I already tested list comprehension which usually works well on lists, but this as expected has not worked:
[val for sublist in risks for val in sublist]
What is the best solution to this?