2

Spline Interpolation

Unsolved
Data Wrangling

Difficulty: 2 | Problem written by Mr. Umair
Spline interpolation uses low polynomial degrees and chooses a polynomial that will result in a smooth dataset. Our data consist of (x,y) coordinates of a train over time. Since motion is restricted for the train, we can expect that the points between (x,y) will be “smooth” rather than jagged.  

By using scipy.interpolate, find univariate splines for the "values" list from the x and y axis data points.

Input:

xAxis ( Time for reaching station ) =  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

yAxis ( Train Number )=  [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]

values= [2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9]

Output:

result= [5.2, 5.4, 5.599999999999998, 5.799999999999998, 5.999999999999999, 6.199999999999999, 6.399999999999999, 6.6, 6.799999999999997]

Sample Input:
<class 'list'>
xAxis: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
yAxis: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
values: [2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9]

Expected Output:
<class 'list'>
[5.2, 5.4, 5.599999999999998, 5.799999999999998, 5.999999999999999, 6.199999999999999, 6.399999999999999, 6.6, 6.799999999999997]

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Fuga doloribus commodi eos soluta nemo impedit cumque vero itaque, enim earum ea non repellat deleniti laboriosam soluta consequuntur doloremque dolor, sed fuga harum? Eveniet enim iusto a dolores at voluptate alias sunt sequi architecto quod, quia labore expedita explicabo atque esse nam iusto, labore minus recusandae mollitia accusantium consequuntur atque necessitatibus, corrupti rem beatae omnis eligendi ipsa eius nam modi architecto nihil minus.

Fuga totam atque ad labore nesciunt consequatur, quaerat illo hic in vero doloribus error modi repellendus mollitia excepturi nobis, cum ab placeat sint maiores explicabo officia facere rerum ea nemo, itaque reiciendis culpa autem, ab modi nesciunt facere ipsam libero perspiciatis animi tenetur qui. Sapiente corrupti ipsam repellendus velit sed repellat deleniti quas, mollitia aliquam labore eveniet, eaque deleniti recusandae nesciunt suscipit amet quidem quibusdam dolorem delectus fugiat consectetur, quos eveniet ipsa fuga. Laborum quasi eligendi ducimus cumque suscipit magnam doloribus voluptatem, molestias fugiat dolorem quos quo. Minus consequuntur totam dolore perferendis placeat ipsum quaerat animi, maiores saepe dicta exercitationem cumque rerum optio, esse impedit et cumque magni expedita eveniet libero in nihil alias, dolor molestiae alias rem.

Quo et rem ratione, illo quis culpa repellendus vero maiores impedit accusamus vitae laboriosam dolore saepe? Aspernatur id nihil atque quidem error natus, consequatur nisi rem quis doloribus placeat ipsa, cumque officia quia id libero animi non impedit rerum debitis, neque libero ratione, eveniet alias ipsam sequi modi impedit nesciunt vitae laboriosam? Non accusantium quos quod est ullam fugiat sint harum a optio.

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)