Questions tagged [linear-interpolation]

Linear interpolation is the process of approximating intermediate values given an assumption that the ranges of missing data look roughly like straight lines.

Linear interpolation is largely used for its simplicity and is typically more effective given a greater density of data. The more complex the underlying relationship of the quantities involved, the less likely linear interpolation is to provide a good value estimates.

In scientific software for statistical computing and graphics, function approx performs 1D linear interpolation.

437 questions
0
votes
3 answers

How to fill irregularly missing values with linear interepolation in BigQuery?

I have data which has missing values irregulaly, and I'd like to convert it with a certain interval with liner interpolation using BigQuery Standard SQL. Specifically, I have data like this: # data is missing irregulary +------+-------+ | time |…
0
votes
1 answer

How to implement 3D bilinear interpolation using numpy?

I have reached to this bilinear interpolation code (added here), but I would like to improve this code to 3D, meaning update it to work with an RGB image (3D, instead of only 2D). If you have any suggestions of how I can to that I would love to…
0
votes
1 answer

interpolate a given array to be in new lenght

in order to interpolate 2 values, I can use lerp(int a, int b) { return (a + b) / 2; } Now imagine I've an array(1, 30, 100, 300) and I want to interpolate it to array in size N (N=10 for example). If N == 7, then: 1,15,30,65,100,200,300 I've…
Maor Cohen
  • 936
  • 2
  • 18
  • 33
0
votes
1 answer

Time series interpolation in Scala

I need to interpolate a time series in Scala Original data is 2020-08-01, value1 2020-08-03, value3 I want to interpolate data in the middle date like this 2020-08-01, value1 2020-08-02, value2 2020-08-03, value3 where value2 is linearly…
0
votes
1 answer

Interpolate between two nearby rows of Dataframe

I would like to interpolate missing values within groups in dataframe using preceding and following rows value. Here is the df (there are more records within a group but for this example I left 3 per group): import numpy as np import pandas as pd df…
Wizytor
  • 105
  • 1
  • 10
0
votes
1 answer

Interpolation of values in a table

I have a source array of values that I should interpolate. I need to overwrite selected cells with an interpolation. The interpolation should be calculated from the adjacent cell (linear = more square). The source values are from all 4 sides (top,…
Glox
  • 11
  • 1
0
votes
1 answer

Computing values of each row of a data.frame using linear interpolation in R?

I would like to compute capacity corresponding to its Level of the ElevationData data.frame. I do have ElevationStorage data.frame where i have standard Elevation and Storage capacity curve data. In case any Level value from ElevationData equals to…
Hydro
  • 1,057
  • 12
  • 25
0
votes
1 answer

Linear Interpolation for Smooth Transition - GDScript

I am trying to have a system that works its way around a 2D grid (a BlendSpace2D for animation) in a smooth fashion. x values can range from -1 to 1 and same for y values. I use the following code on a Vector2 to attempt to do this and it fails to…
0
votes
3 answers

How to interpolate in Python?

I want to make a linear interpolation of the column Value_B in my dataframe df2. How can I do this with python in an easy way? df2 = pd.DataFrame(np.array([[1, 2, 10], [2, 5, ''], [3, 8, 30], [4, 2, ''], [5, 5, 50], [6, 8, '']]), columns=['Angle',…
user8504877
0
votes
1 answer

Different errors in using left_join in r

I am trying to interpolate two series but I get different errors when it comes to use left_join. These are the two series: df1 = structure(list(Date = structure(c(11690, 11725, 11753, 11781, 11809, 11844, 11872, 11900, 11942, 11970, 11998, 12026,…
Rollo99
  • 1,601
  • 7
  • 15
0
votes
0 answers

How to return linear interpolation from a Pandas dataframe for a n-dimensional problem?

I'm looking to interpolate solutions described by the function Result = Fn(x0, x1, x2, x3, x4) x0 has 20 values, x1 has 10 values, x2 has 6 values, x3 has 10 values, x4 has 4 values Some of the values are linearly spaced, and others are log…
Mark Burgoyne
  • 1,524
  • 4
  • 18
  • 31
0
votes
3 answers

NumPy: How to calulate piecewise linear interpolant on multiple axes

Given the following ndarray t - In [26]: t.shape Out[26]: (3, 3, 2) In [27]: t …
user2309803
  • 541
  • 5
  • 15
0
votes
1 answer

Multiple columns with NAs, impute NAs by grouped linear interpolation

I have several columns with NAs, I want to impute the NAs of columns based on the state the row belongs to using linear interpolation. I'd also like in the same code to create new column names that are interp_[variable name] formatted.
purple_plop
  • 280
  • 1
  • 10
0
votes
2 answers

Linear interpolation between points in a list

I have a list in python like this [4, 0, 0, 6, 0, 8, 0, 0, 0, 3], and I want to convert into something like this [4, 4.67, 5.33, 6, 7, 8, 6.75, 5.5, 4.25, 3]. Basically just replacing zeroes with an interpolation of the points already in the list.…
mazore
  • 984
  • 5
  • 11
0
votes
2 answers

Interpolating data only between first and last observation in R

I am a little stuck here and could use some help. I am trying to interpolate some missing data in a time series, but a lot of my cases (countries) only have few observations and are often not consistent. So I am trying to interpolate beween the…
H.Stevens
  • 391
  • 3
  • 16