Category "python-datetime"

Python Plotly How to remove datetime gaps in candle stick chart?

I am trying to remove the datetime gaps in my candlestick (the gaps are the time periods when the stock market is closed, hence there are not data). Can't seem

Pandas - Take value n month before

I am working with datetime. Is there anyway to get a value of n months before. For example, the data look like: dft = pd.DataFrame( np.random.randn(100, 1),

AttributeError: 'TimedeltaProperties' object has no attribute 'minute'

I have a dataframe that looks like this df [output]: date time 2020-02-28 00:30:45 2020-02-28 00:30:45 2020-03-09 00:21:06 2020-03-09 00:21:06 2020-

calculating duration between two time columns

enter image description here I have entry and exit time and I want to derive the total duration in seconds . I first converted it into date time and then made s

Convert string to date using arrow python

I'm trying to convert string to date using arrow module. During the conversion, I received this error: arrow.parser.ParserMatchError: Failed to match '%A %d %B

Is it possible to update a line of already printed text in python?

I am working on a text based operating system in Python and I am wondering if it would be possible to update an already printed string on the same line. There d

How to compare just the date or just date time ignoring seconds in a Python Pandas dataframe column of mixed data types?

In a pandas dataframe, I have a column of mixed data types, such as text, integers and datetimes. I need to find columns where datetimes match: (1) exact values

How do I set or freeze time in python?

I want to set a fixed time using python different than that seen locally on my system , so that when I used datetime.date.today() I get to see the desired date

How do I reorder a long string of concatenated date and timestamps seperated by commas using Python?

I have a string type column called 'datetimes' that contains multiple dates with their timestamps, and I'm trying to extract the earliest and last dates (withou

How do I reorder a long string of concatenated date and timestamps seperated by commas using Python?

I have a string type column called 'datetimes' that contains multiple dates with their timestamps, and I'm trying to extract the earliest and last dates (withou

pandas to_dict with python native datetime type and not timestamp

I have a pandas DataFrame df that contains Timesatamp columns. I wish to create an iterator of rows (either via the iter.. methods or via to_dict) from df whe

Adding timestamp index column with a column header to existing csv (python)

#gets rid of spaces in existing csv headers def getColumns(readCSV): return [column.replace(' ','') for column in next(readCSV)] #insert format used to

Comparing two datetime strings

I have two DateTime strings. How would I compare them and tell which comes first? A = '2019-02-12 15:01:45:145' B = '2019-02-12 15:02:02:22'

how to extract open pull req properties from github using pygithub

I want to send notifications to the owners of old(60 days) open pull requests on github - this will help in making the git repo healthy . I could manage to extr

Getting today's date in YYYY-MM-DD in Python?

Is there a nicer way than the following to return today's date in the YYYY-MM-DD format? str(datetime.datetime.today()).split()[0]

How to convert integer into date object python?

I am creating a module in python, in which I am receiving the date in integer format like 20120213, which signifies the 13th of Feb, 2012. Now, I want to conver

Convert DataFrame column type from string to datetime

How can I convert a DataFrame column of strings (in dd/mm/yyyy format) to datetimes?