-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for comparison issue in columns_equal when ignore_case=True (Generated by Ana - AI SDE) #329
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ana-ai-sde There seem to be some issues with the code. Also there are no new unit tests included in the PR.
@@ -749,6 +749,9 @@ def render(filename: str, *fields: Union[int, float, str]) -> str: | |||
return file_open.read().format(*fields) | |||
|
|||
|
|||
import pandas as pd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be placed at the top of the file as it doesn't conform to our code quality guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fdosani
Thanks for highlighting this. We will look into this as to why this happened.
BR,
Team Ana
@@ -816,9 +819,9 @@ def columns_equal( | |||
col_2 = col_2.str.strip() | |||
|
|||
if ignore_case: | |||
if col_1.dtype.kind == "O": | |||
if col_1.dtype == 'object' and col_1.apply(lambda x: isinstance(x, str)).all(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems incorrect. The dtype
would return an O
not object
AFAIK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fdosani
The comment is partially correct. dtype.kind
returns 'O' for object types, while dtype
itself returns 'object'. Both col_1.dtype.kind == "O"
and col_1.dtype == 'object'
are valid ways to check for object dtypes. The proposed change adds an extra check to ensure all elements are strings, which may be useful depending on the specific requirements of the comparison.
BR,
Team Ana
Hi @fdosani BR, |
Thanks for the PR, at this time the SDE contributions don't meet our contributor guidelines. Closing this for as of now. |
Description
This PR addresses an issue in the
columns_equal
function where comparingdatetime.date
columns incorrectly returns false differences whenignore_case=True
. The patch ensures that string operations are only performed on appropriate types, resolving this issue.This patch was generated by Ana - AI SDE, an AI-powered software development assistant.
This is a fix for Issue 327