Is the code correct for not equal to, i doubt 'ne'. if condition in ['>', '<', '=',…
Jump to turn (6)
- 1Is the code correct for not equal to, i doubt 'ne'. if condition in ['>', ' =',
- 2Code for this : ['A', 'B', ' 5 % absolut'] means all positions with tolerance be
- 3I think the math for df = df[abs(df[col1] - df[col2]) df[col2]tolpercent] is wro
- 4Shorten this code: condition.strip('%').strip('percent').strip('percentage').rep
- 5re.sub(r'\W+', '', '20 perc'.lower().replace('%', '')) gives'20perc'!
- 6How remove trailing zeros in float type column pandas without converting to stri
- User
Is the code correct for not equal to, i doubt 'ne'. if condition in ['>', '<', '=', '>=', '<=', '!=']: signs_dict = {'>':'gt', '>=':'ge', '<':'lt', '<=':'le', '=':'eq', '==':'eq', '!=':'ne'} df_ = df.loc[getattr(df[col1], signs_dict.get(condition, '<'))(df[col2])]
- Assistant
Yes, the code is correct for not equal to. The 'ne' in the signs_dict maps to the operator '!=' which is the not equal to operator.
- User
Code for this : ['A', 'B', '<5 % abs'] means all positions with tolerance between -5 to 5. ['A', 'B', '> 5 % absolut'] means all positions with tolerance beyond -5 to 5.
- Assistant