Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas date_range

index = pd.date_range(start='2020-8-15', end = '2021-8-11', freq='M')
print(index)

>>>DatetimeIndex(['2020-08-31', '2020-09-30', '2020-10-31', '2020-11-30',
                 '2020-12-31', '2021-01-31', '2021-02-28', '2021-03-31',
                 '2021-04-30', '2021-05-31', '2021-06-30', '2021-07-31'],
                 dtype='datetime64[ns]', freq='M')
Comment

pandas date range

import pandas as pd
date1 = '2011-05-03'
date2 = '2011-05-10'
mydates = pd.date_range(date1, date2).tolist()
Comment

www.pd.date_range

>>> pd.date_range(start='1/1/2018', periods=5, freq='3M')
DatetimeIndex(['2018-01-31', '2018-04-30', '2018-07-31', '2018-10-31',
               '2019-01-31'],
              dtype='datetime64[ns]', freq='3M')
Comment

www.pd.date_range

>>> pd.date_range(start='1/1/2018', periods=8)
DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
               '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'],
              dtype='datetime64[ns]', freq='D')
Comment

www.pd.date_range

>>> pd.date_range(start='1/1/2018', end='1/08/2018')
DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
               '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'],
              dtype='datetime64[ns]', freq='D')
Comment

PREVIOUS NEXT
Code Example
Python :: split a string with 2 char each in python 
Python :: write binary file in python 
Python :: plotly graph object colorscale 
Python :: pandas categorical to numeric 
Python :: how to auto install geckodriver in selenium python with .install() 
Python :: django check user admin 
Python :: how to create dictionary between two columns in python 
Python :: pyserial read 
Python :: python insert sorted list 
Python :: random.choice 
Python :: how to write in a text file python 
Python :: run django localhost server 
Python :: python filter dictionary by keys 
Python :: __new__ python 
Python :: push element to list python 
Python :: redirect parameters flask 
Python :: django render template 
Python :: python re compile 
Python :: pandas split dataframe into chunks with a condition 
Python :: matplotlib styles attr 
Python :: python read and write pdf data 
Python :: isdigit python 
Python :: Python NumPy split Function Example 
Python :: is string mutable in python 
Python :: float infinity python 
Python :: python 3d array 
Python :: turn list in to word python 
Python :: python pause function 
Python :: python if condition assignment in one line 
Python :: subtract current date from pandas date column 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =