0

I have two dataframes, flat and bias. Bias has some missing values. (2456650, 2459654). After subtracting bias from flat, I got the result for the remaining values. My task is to check for the nearest value in bias to do the subtraction for missing values. I have to check for 2459654, which is a missing value in the bias, I have to check for (2459653 or 2459655). If they are not present, I have to check for (2459652 or 2459656) and subtract any value. I have to check for both + and -, unless I got one.

flat_DataFrame

Bias_DataFrame

After subtracting the result

But i hvae to check for values now which are not presnent in bias.

  • `flat[1].sub(flat[0].map(bias.set_index(0)[1]), fill_value=0)` (untested, but the general logic is there) – mozway Jun 16 '22 at 19:45
  • Sir as 2459650 is not available in bias I need to look for 2459650-1 or 2459650+1 in bias, whichever is available I need to map it for subtraction – Pritam Das Jun 16 '22 at 20:52
  • Please provide the DataFrame constructors of `flat` and `bias` – mozway Jun 16 '22 at 20:54
  • https://i.stack.imgur.com/5Qnil.png these are the data with flat having duplicates – Pritam Das Jun 17 '22 at 04:52
  • But we can't load an image in our python interpreter, [you need to provide DataFrame constructors](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). – mozway Jun 17 '22 at 04:56
  • sir can i provide u the csv? – Pritam Das Jun 17 '22 at 05:14
  • https://mega.nz/folder/8xliEKqQ#ps8xfyPdwt62vFAWvN2McA – Pritam Das Jun 17 '22 at 05:19
  • I have two dataframes flat and bias. Bias has some missing values (2456650,2459654). After subtracting bias from flat I got the result for the remaining values. My task is to check for nearest value in bias to do the subtraction for missing values. Like for 2459654 which is a missing value in bias I have to check for (2459653 or 2459655) if they are not present i have to check for (2459652 or 2459656) and subtract with any value. I have to check for both + and - unless I got one – Pritam Das Jun 17 '22 at 05:21

0 Answers0