Skip to content
Advertisement

Tag: python-datetime

Python 3.9: unpickling of IsoCalendarDate data returns a tuple

Consider the following discussion / feature in Python3.9: https://bugs.python.org/issue24416 In short, it was decided that the result of datetime.date.isocalendar would be changed to a namedtuple instead of tuple. Now, I can see the benefit in doing that, but they also decided “to pickle” the new object (datetime.IsoCalendarDate) as a tuple: https://github.com/python/cpython/commit/1b97b9b0ad9a2ff8eb5c8f2e2e7c2aec1d13a330#diff-2a8962dcecb109859cedd81ddc5729bea57d156e0947cb8413f99781a0860fd1R1214 So my question is, why did they make it

How to find out week no of the month in python?

I have seen many ways to determine week of the year. Like by giving instruction datetime.date(2016, 2, 14).isocalendar()[1] I get 6 as output. Which means 14th feb 2016 falls under 6th Week of the year. But I couldn’t find any way by which I could find week of the Month. Means IF I give input as some_function(2016,2,16) I should get

timedelta error with numpy.longdouble dtype

I have times with dtype numpy.longdouble and when I’m trying to use that values with timedelta function I’ve got errors. But when I convert it to numpy.float64 everything is fine. Could somebody explain that behaviour? When I’m trying to see dtypes of variables they are look the similar but not the same: Edit And it’s strange that it’s not working

Advertisement