Top "Python-datetime" questions

Python's built-in datetime module provides classes for manipulating dates and times in both simple and complex ways.

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 …

python numpy types timedelta python-datetime
How to convert datetime from string format into datetime format in pyspark?

I created a dataframe using sqlContext and I have a problem with the datetime format as it is identified as …

datetime apache-spark pyspark spark-dataframe python-datetime
Pandas: Cannot convert type <class 'pandas.tseries.index.DatetimeIndex'> to Timestamp

I got the following error message when trying to slicing a pandas dataframe using labels. triggerDate = dat.loc[dat.Close &…

pandas numpy python-datetime datetimeindex
How can I get the first day of the next month in Python?

How can I get the first date of the next month in Python? For example, if it's now 2019-12-31, …

python python-datetime
What's the most elegant way to get the end of the day (datetime)?

I'm currently writing some reporting code that allows users to optionally specify a date range. The way it works (simplified), …

python python-datetime
How to handle times with a time zone in Matplotlib?

I have data points whose abscissas are datetime.datetime objects with a time zone (their tzinfo happens to be a …

python matplotlib plot timezone python-datetime
Why do I get an AttributeError when I use scatter() but not when I use plot()

I wish to plot using Matplotlib/pylab and show date and time on the x-axis. For this, I'm using the …

python matplotlib python-datetime
Pandas: Rounding to nearest Hour

I have a column with timestamps start_time: 0 2016-06-04 05:18:49 1 2016-06-04 06:50:12 2 2016-06-04 08:16:02 3 2016-06-04 15:05:13 4 2016-06-04 15:24:25 I want …

python pandas datetime-format python-datetime
Weekday name from a pandas dataframe Date object

I would like to get the weekday name for all my date. I have a pandas df which has a …

python-3.x python-datetime