'Transition from np.polyfit() to Polynomial - replacement for poly1d()?

As mentioned here the np.polyfit should be replaced with Polynomial in new projects. There is also a transition guide. But there is some functionality of the older syntax that I don't know how to reproduce with the new one:

    p = np.polyfit(x_data, y_data, 5)
    p = np.poly1d(p)  # what to use with Polynomial instead?
    print(p(10))  # I want something like this

How can I do the same with the newer Polynomial?



Solution 1:[1]

Sorry, I thought I had tried it and it didn't work, but the solution is trivial:

p = np.polyfit(x_data, y_data, 5)
print(p(10))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 natter1