Skip to content

DataFrame.approxQuantile was not accepting a single Column object when passed to the col parameter. #4124

@teja0909

Description

@teja0909

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?
    python 3.10

  2. What operating system and processor architecture are you using?

    Windows-10-10.0.26200-SP0

  3. What are the component versions in the environment (pip freeze)?

snowflake-snowpark-python -1.47.0

  1. What did you do?
 data = [
    Row(id=1, dept="IT", salary=5000),
    Row(id=2, dept="IT", salary=7000),
    Row(id=3, dept="HR", salary=4000),
    Row(id=4, dept="HR", salary=4500),
]

df = session.create_dataframe(data)
approx_q_column_object = df.approxQuantile(
        col("salary"),
        [0.5, 0.9]
    )

TypeError: Cannot convert a Column object into bool: please use '&' for 'and', '|' for 'or', '~' for 'not' if you're building DataFrame filter expressions. For example, use df.filter((col1 > 1) & (col2 > 2)) instead of df.filter(col1 > 1 and col2 > 2).
5. What did you expect to see?

Instead of error , I am expecting Dataframe with the results.

  1. Can you set logging to DEBUG and collect the logs?

    import logging
    
    for logger_name in ('snowflake.snowpark', 'snowflake.connector'):
        logger = logging.getLogger(logger_name)
        logger.setLevel(logging.DEBUG)
        ch = logging.StreamHandler()
        ch.setLevel(logging.DEBUG)
        ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
        logger.addHandler(ch)
    

Metadata

Metadata

Assignees

Labels

status-triage_doneInitial triage done, will be further handled by the driver team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions