0

I have a data frame in python. We can take any hypothetical table.

I need to make a new subsets of that dataframe for each calcution in an array..

On top of it there are so many calculations in that array. I can't simply write df.loc[1,2]. Is there a way to link 1s and 2s in .loc with other column in that dataframe.

I am new to python so apologize if I use some wrong term. Basically I am advance excel google sheet user. There it's common to drag complex vlookups down the column. In a nut shell if you know excel or google sheet, I am trying to get last vlookup value for a table's upper section and then dragging this formula down. Above question is first step to get this in python.

Link to excel sheet i want to replicate in python. https://docs.google.com/spreadsheets/d/1SUXbrooN_LdxLfe9OztEBZTb0Lf8jyAy/edit?usp=sharing&ouid=108035388403170702950&rtpof=true&sd=true

Link to python colab code https://colab.research.google.com/drive/1RpyjmsJk9O2y4pYe9r3RD8AEOZWr10HB?usp=sharing

Link to google sheet from where colab pull and pastes data https://colab.research.google.com/drive/1RpyjmsJk9O2y4pYe9r3RD8AEOZWr10HB?usp=sharing

Step 1: to be able to do vlookups as done in excel red cells.

for ref cell Q2 in data sheet, need following formula in python

 IFERROR(LOOKUP(2,1/($D$1:D1=D2),$Q$1:Q1),0)
  • Could you please provide a MRE: See [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) and [How to make good reproducible pandas examples](https://stackoverflow.com/q/20109391/14311263) – Timus Nov 19 '21 at 18:32
  • hi. thanks for reply.. please check link i added to question for ref... please let me know if you need more clarification. – Awais Anwar Nov 20 '21 at 05:27

0 Answers0