georgia-tech-db / evadb

Database system for AI-powered apps
https://evadb.ai/docs
Apache License 2.0
2.64k stars 262 forks source link

Python 3.8 'DataFrame' object has no attribute 'map' #1366

Open xzdandy opened 12 months ago

xzdandy commented 12 months ago

Search before asking

Bug

evadb/executor/project_executor.py:49: in exec
    batch = apply_project(batch, self.target_list)
evadb/executor/executor_utils.py:69: in apply_project
    batches = [expr.evaluate(batch) for expr in project_list]
evadb/executor/executor_utils.py:69: in <listcomp>
    batches = [expr.evaluate(batch) for expr in project_list]
evadb/expression/function_expression.py:129: in evaluate
    outcomes = self._apply_function_expression(func, batch, **kwargs)
evadb/expression/function_expression.py:188: in _apply_function_expression
    return func_args.apply_function_expression(func)
evadb/models/storage/batch.py:174: in apply_function_expression
    return Batch(expr(self._frames))
evadb/functions/abstract/abstract_function.py:36: in __call__
    return self.forward(args[0])
evadb/functions/helpers/upper.py:37: in forward
    ret["output"] = df.map(lambda s: s.upper() if type(s) is str else s)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self =    input
0  EvaDB, name = 'map'

    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'DataFrame' object has no attribute 'map'

test_evadb/lib/python3.8/site-packages/pandas/core/generic.py:5989: AttributeError

Environment

https://app.circleci.com/pipelines/github/georgia-tech-db/evadb/6111/workflows/e8c13913-0f88-42f5-86a7-0dd9b61cda2f/jobs/44296

Are you willing to submit a PR?

xzdandy commented 11 months ago

@gaurav274 @jarulraj Shall we support python 3.8?

DataFrame.map is available after panda 2.1.0. However, it turns that this is not possible with python 3.8. Check the https://app.circleci.com/pipelines/github/georgia-tech-db/evadb/6180/workflows/ca63c7b4-8873-45a5-a5c2-3db4d06bf973/jobs/44816