Elysire - 7 days ago 7

Python Question

My datas :

`LogRatio Strength`

0.555 9.1

0.542 9.6

0.533 9.7

0.532 9.3

0.519 9.2

0.508 9.5

I want to have the point(LogRatio,Strength) that is the median

`indexA = 0`

indexB = 4

point_logRatio = df['LogRatio'][indexA:indexB].median()

point_Strength = df[df['LogRatio']==point_logRatio['Strength'].iloc[0]

But

That's why my

So, if you have an easier way to get the LogRatio and the Strength at the same time where LogRatio is at a

At the end, I would like to have :

Because 0.533 is the logRatio at the median position between my index 0 and 4 in my dataframe and the strength corresponding is 9.7.

Answer

you can try

```
median_position = (indexA+indexB)/2
point_logRatio = df.iloc[median_position]['LogRatio']
point_Strength = df.iloc[median_position]['Strength']
```