Skip to content
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

Difference between calamine and openpyxl readers fixed #59188

Closed
wants to merge 1 commit into from

Conversation

Riyazul555
Copy link

@Riyazul555 Riyazul555 commented Jul 5, 2024

@Riyazul555 Riyazul555 requested a review from rhshadrach as a code owner July 5, 2024 14:32
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Please always add tests.

StorageOptions,
)

_CellValue = Union[int, float, str, bool, time, date, datetime, timedelta]
_CellValueT = Union[int, float, str, bool, time, date, datetime, timedelta]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this changing? I think we only use T suffix for TypeVar, not type aliases.

def _convert_cell(value: _CellValue) -> Scalar | NaTType | time:
) -> list[list[Scalar]]:
def _convert_cell(value: _CellValueT) -> Scalar:
# Avoid explicit conversion to pd.Timestamp and pd.Timedelta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment is necessary/helpful.

Comment on lines 110 to +114
elif isinstance(value, date):
return pd.Timestamp(value)
return value
elif isinstance(value, timedelta):
return pd.Timedelta(value)
elif isinstance(value, time):
return value
elif isinstance(value, time):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these can just be removed. We only need elif instance(value, ...) if we are going to do something besides just returning value.

Comment on lines +120 to +126
rows: list[list[_CellValueT]] = sheet.to_python(skip_empty_area=False)
data: list[list[Scalar]] = []

for row in rows:
data.append([_convert_cell(cell) for cell in row])
if file_rows_needed is not None and len(data) >= file_rows_needed:
break
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this changing?

Copy link
Contributor

github-actions bot commented Aug 7, 2024

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Aug 7, 2024
@rhshadrach
Copy link
Member

rhshadrach commented Aug 7, 2024

Closing as stale. @Riyazul555 - if you'd like to continue, address the comments above and we'd be happy to reopen!

@rhshadrach rhshadrach closed this Aug 7, 2024
@rhshadrach rhshadrach added the IO Excel read_excel, to_excel label Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Excel read_excel, to_excel Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Difference between calamine and openpyxl readers - columns with mixed data types
3 participants