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

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 :: random int in python 3 
Python :: how to split a list to 1000 items python 
Python :: program to calculate the volume of sphere python 
Python :: pandas predict average moving 
Python :: discard vs remove python 
Python :: set axis ticks matplotlib 
Python :: images subplot python 
Python :: f string float format 
Python :: calculator in one line in python 
Python :: scikit learn ridge classifier 
Python :: python series sort 
Python :: pil to rgb 
Python :: python html to pdf 
Python :: discord command addrole python 
Python :: python write yaml 
Python :: strftime python 
Python :: run code with different verions of python 
Python :: get from time secs and nsecs 
Python :: python f string columns 
Python :: line number in logging python 
Python :: how to remove first few characters from string in python 
Python :: how to make a bot say hello <username when a user says hello in discord with python 
Python :: double .get().get() dict python 
Python :: build spacy custom ner model stackoverflow 
Python :: string to list in python comma 
Python :: python elementtree build xml 
Python :: 2 d array in python with zeroes 
Python :: pytube search feature 
Python :: df invert sort index 
Python :: python primera letra mayuscula 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =