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

Cross off a few tslibs-TODOs #18443

Merged
merged 7 commits into from
Nov 25, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pandas/_libs/src/datetime.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ cdef extern from "datetime/np_datetime.h":

int dayofweek(int y, int m, int d) nogil
int is_leapyear(int64_t year) nogil
PANDAS_DATETIMEUNIT get_datetime64_unit(object o)

cdef extern from "datetime/np_datetime_strings.h":

Expand Down
8 changes: 2 additions & 6 deletions pandas/_libs/src/datetime/np_datetime.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,18 +564,15 @@ void pandas_datetime_to_datetimestruct(npy_datetime val, PANDAS_DATETIMEUNIT fr,

void pandas_timedelta_to_timedeltastruct(npy_timedelta val,
PANDAS_DATETIMEUNIT fr,
pandas_timedeltastruct *result) {
pandas_timedeltastruct *result) {
pandas_datetime_metadata meta;

meta.base = fr;
meta.num - 1;
meta.num = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for fixing this typo. Do we even need the assignment at all though? Worth considering removal?

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'm advocating moving the timedelta_struct stuff out of src/ entirely. The src/ directory is a PITA and we can put it in cython directly without taking a performance hit.


convert_timedelta_to_timedeltastruct(&meta, val, result);
}

PANDAS_DATETIMEUNIT get_datetime64_unit(PyObject *obj) {
return (PANDAS_DATETIMEUNIT)((PyDatetimeScalarObject *)obj)->obmeta.base;
}

/*
* Converts a datetime from a datetimestruct to a datetime based
Expand Down Expand Up @@ -1001,7 +998,6 @@ int convert_datetime_to_datetimestruct(pandas_datetime_metadata *meta,
int convert_timedelta_to_timedeltastruct(pandas_timedelta_metadata *meta,
npy_timedelta td,
pandas_timedeltastruct *out) {
npy_int64 perday;
npy_int64 frac;
npy_int64 sfrac;
npy_int64 ifrac;
Expand Down
3 changes: 0 additions & 3 deletions pandas/_libs/src/datetime/np_datetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,4 @@ convert_timedelta_to_timedeltastruct(pandas_timedelta_metadata *meta,
pandas_timedeltastruct *out);


PANDAS_DATETIMEUNIT get_datetime64_unit(PyObject *obj);


#endif // PANDAS__LIBS_SRC_DATETIME_NP_DATETIME_H_