Skip to content

truediv argument of pandas.eval ignored. #28446

Closed
@simonjayhawkins

Description

@simonjayhawkins

Code Sample, a copy-pastable example if possible

>>> import pandas as pd
>>>
>>> pd.__version__
'0.25.0+350.g330bedeb7'
>>>
>>> df = pd.DataFrame({'A': range(1, 6)})
>>>
>>> df.eval('A/2')
0    0.5
1    1.0
2    1.5
3    2.0
4    2.5
dtype: float64
>>>
>>> df.eval('A/2', truediv = False)
0    0.5
1    1.0
2    1.5
3    2.0
4    2.5
dtype: float64
>>>
>>> df.eval('A/2', truediv = True)
0    0.5
1    1.0
2    1.5
3    2.0
4    2.5
dtype: float64

Problem description

The docs state..

truediv : bool, optional
    Whether to use true division, like in Python >= 3

but the truediv argument is ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions