Reputation: 515
I would like to select some part of my data to plot, and the conditions are equations. for example: select_data = Qtn < Fr**2 and Qtn > 0.1*Fr The complete code and data are here
df = pd.DataFrame()
df['Qtn'] = np.linspace(0.1,10,100)
df['Fr'] = np.linspace(0.1,200,100)
data_select = df[(df.Qtn < (70/((1+0.06*df.Fr)**17)+11)) & (df.Qtn > ((32*70-1000)/(100-32*df.Fr))) ]
but this is not working because is not making element-wise with the df.Fr this is my data and what I would like to select is the SC area based on the equation of the lines 1 and 2
But when I run the code what I can select is this:
Upvotes: 1
Views: 44
Reputation: 1322
Your equation(32*70-1000)/(100-32*Fr)
becomes negative after the asymptote:
import numpy as np
import matplotlib.pyplot as plt
qt2 = (32*70-1000)/(100-32*Fr)
Fr = np.logspace(-3, 3, 100)
plt.semilogx(Fr, qt2)
So after Fr > 100/32
(where the denominator in your equation hits 0), you will satisfy both conditions again. So adding a condition to restrict Fr
values would be a more general solution than restricting to less than the intersection of the curves:
df[(df.Qtn < (70/((1+0.06*df.Fr)**17)+11)) & (df.Qtn > ((32*70-1000)/(100-32*df.Fr)) & (df.Fr < 100/32) ]
Upvotes: 1