Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Creation from Excel Serial Dates #979

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

Open
anishnya wants to merge 1 commit into arrow-py:master
base: master
Choose a base branch
Loading
from anishnya:excel_date

Conversation

Copy link
Member

@anishnya anishnya commented May 26, 2021
edited by jadchaar
Loading

Pull Request Checklist

Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

  • 🧪 Added tests for changed code.
  • 🛠️ All tests pass when run locally (run tox or make test to find out!).
  • 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
  • 📚 Updated documentation for changed code.
  • ⏩ Code is up-to-date with the master branch.

If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

Description of Changes

Closes: #977. New support for creation of Arrow objects from Excel Serial Dates. There seems to be an issue with the linting of the docs, after some tests have been run. Not too sure what it is at first glance.

wroldwiedbwe reacted with thumbs up emoji
@anishnya anishnya requested a review from jadchaar May 26, 2021 07:59
Copy link

codecov bot commented May 26, 2021
edited
Loading

Codecov Report

Merging #979 (9e0cb4f) into master (119bb67) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@ Coverage Diff @@
## master #979 +/- ##
=========================================
 Coverage 100.00% 100.00% 
=========================================
 Files 10 10 
 Lines 2054 2064 +10 
 Branches 330 332 +2 
=========================================
+ Hits 2054 2064 +10 
Impacted Files Coverage Δ
arrow/arrow.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 119bb67...9e0cb4f. Read the comment docs.

Copy link
Member

@jadchaar jadchaar left a comment

Choose a reason for hiding this comment

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

Couple of comments


@classmethod
def excel_date(
cls, delta: Union[int, float], default_windows_date: bool = True
Copy link
Member

Choose a reason for hiding this comment

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

Should we change the kwarg to instead use the Microsoft terminology of 1900 and 1904 datesystem: https://docs.microsoft.com/en-us/office/troubleshoot/excel/1900-and-1904-date-system? Like make the kwarg 1904_date_system=True? Or do you think using the OS names is clearer?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it makes more sense to use the 1900/1904 convention. I looked in Excel and that's what they end up of using.

Comment on lines +1816 to +1821
if delta < 60:
start_date = arrow.get("1899年12月31日")
else:
start_date = arrow.get("1899年12月30日")
else:
start_date = arrow.get("1904年01月01日")
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using arrow.get() you can call cls.get().

Copy link
Member

@krisfremen krisfremen left a comment

Choose a reason for hiding this comment

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

Would this PR be incorporating the decimal portion of the excel serial?

Copy link
Member Author

Would this PR be incorporating the decimal portion of the excel serial?

Yes it would. I can add test cases to make it more clear.

Copy link
Member

jadchaar commented Aug 9, 2021

Rather than creating a new function, I think it may be more consistent with our existing get() interface to add this as a keyword argument like arrow.get(..., excel: bool, default_windows_date: bool). If the excel kwarg is present, we parse the timestamp as an excel timestamp (and account for the default_windows_date kwarg as well), else just parse the input time string as normal.

Copy link
Collaborator

@jadchaar do you think that arrow.get() might have too many kwargs if we add this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@krisfremen krisfremen krisfremen left review comments

@jadchaar jadchaar jadchaar requested changes

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add support for Excel date format

AltStyle によって変換されたページ (->オリジナル) /