'I'm trying to solve for y using sympy why does the below not work?
I have a dataframe and i would like to find out what value the spend column needs to be greater than or equal to to result in the filtered dataframe being 50% of all the data.
e.g.
len(data[data['spend'] >= x ])/len(data) = 0.5
i am trying to solve for x. I tried using the library sympy but it does not work.
x= Symbol('x')
eqn = Eq(len(data[data['spend'] >= x ]) = len(data) * 0.5)
the error i get is:
SyntaxError: keyword can't be an expression
How can i solve the above? I dont want to have to do this iteratively, so am wondering what i should do.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
