Detail: IndexHierarchyGO: Accessor Datetime
Overview: IndexHierarchyGO: Accessor Datetime
- IndexHierarchyGO.via_dt.__call__(*, fill_value)
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.__call__(*, fill_value)[source]
- Parameters:
fill_value – If NAT are encountered, use this value.
>>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', ''), ('', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 NaT NaT 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt(fill_value=-1).month [[ 4 4] [12 -1] [-1 6]]
- IndexHierarchyGO.via_dt.year
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.year
Return the year of each element.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.year [[1517 2022] [1517 2021] [1517 2022]]
- IndexHierarchyGO.via_dt.year_month
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.year_month
Return the year and month of each element as string formatted YYYY-MM.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.year_month [['1517-04' '2022-04'] ['1517-12' '2021-12'] ['1517-06' '2022-06']]
- IndexHierarchyGO.via_dt.year_quarter
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.year_quarter
Return the year and quarter of each element as a string formatted YYYY-QQ.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.year_quarter [['1517-Q2' '2022-Q2'] ['1517-Q4' '2021-Q4'] ['1517-Q2' '2022-Q2']]
- IndexHierarchyGO.via_dt.month
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.month
Return the month of each element, between 1 and 12 inclusive.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.month [[ 4 4] [12 12] [ 6 6]]
- IndexHierarchyGO.via_dt.day
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.day
Return the day of each element, between 1 and the number of days in the given month of the given year.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.day [[ 1 1] [31 31] [30 30]]
- IndexHierarchyGO.via_dt.hour
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.hour
Return the hour of each element, between 0 and 24.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.hour [[0 0] [0 0] [0 0]]
- IndexHierarchyGO.via_dt.minute
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.minute
Return the minute of each element, between 0 and 60.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.minute [[0 0] [0 0] [0 0]]
- IndexHierarchyGO.via_dt.second
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.second
Return the second of each element, between 0 and 60.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.second [[0 0] [0 0] [0 0]]
- IndexHierarchyGO.via_dt.weekday
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.weekday()[source]
Return the day of the week as an integer, where Monday is 0 and Sunday is 6.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.weekday() [[6 4] [0 4] [5 3]]
- IndexHierarchyGO.via_dt.quarter
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.quarter()[source]
Return the quarter of the year as an integer, where January through March is quarter 1.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.quarter() [[2 2] [4 4] [2 2]]
- IndexHierarchyGO.via_dt.is_month_end
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.is_month_end()[source]
Return Boolean indicators if the day is the month end.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.is_month_end() [[False False] [ True True] [ True True]]
- IndexHierarchyGO.via_dt.is_month_start
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.is_month_start()[source]
Return Boolean indicators if the day is the month start.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.is_month_start() [[ True True] [False False] [False False]]
- IndexHierarchyGO.via_dt.is_year_end
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.is_year_end()[source]
Return Boolean indicators if the day is the year end.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.is_year_end() [[False False] [ True True] [False False]]
- IndexHierarchyGO.via_dt.is_year_start
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.is_year_start()[source]
Return Boolean indicators if the day is the year start.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.is_year_start() [[False False] [False False] [False False]]
- IndexHierarchyGO.via_dt.is_quarter_end
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.is_quarter_end()[source]
Return Boolean indicators if the day is the quarter end.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.is_quarter_end() [[False False] [ True True] [ True True]]
- IndexHierarchyGO.via_dt.is_quarter_start
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.is_quarter_start()[source]
Return Boolean indicators if the day is the quarter start.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.is_quarter_start() [[ True True] [False False] [False False]]
- IndexHierarchyGO.via_dt.timetuple
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.timetuple()[source]
Return a
time.struct_time
such as returned by time.localtime().
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.timetuple() [[time.struct_time(tm_year=1517, tm_mon=4, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=6, tm_yday=91, tm_isdst=-1) time.struct_time(tm_year=2022, tm_mon=4, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=4, tm_yday=91, tm_isdst=-1)] [time.struct_time(tm_year=1517, tm_mon=12, tm_mday=31, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=365, tm_isdst=-1) time.struct_time(tm_year=2021, tm_mon=12, tm_mday=31, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=4, tm_yday=365, tm_isdst=-1)] [time.struct_time(tm_year=1517, tm_mon=6, tm_mday=30, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=181, tm_isdst=-1) time.struct_time(tm_year=2022, tm_mon=6, tm_mday=30, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=181, tm_isdst=-1)]]
- IndexHierarchyGO.via_dt.isoformat(sep, timespec)
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.isoformat(sep='T', timespec='auto')[source]
Return a string representing the date in ISO 8601 format, YYYY-MM-DD.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30')), index_constructors=sf.IndexDate) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <datetime64[D]> <datetime64[D]> >>> ih.via_dt.isoformat() [['1517-04-01' '2022-04-01'] ['1517-12-31' '2021-12-31'] ['1517-06-30' '2022-06-30']]
- IndexHierarchyGO.via_dt.fromisoformat
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.fromisoformat()[source]
Return a
datetime.date
object from an ISO 8601 format.
>>> ih = sf.IndexHierarchyGO.from_labels((('1517-04-01', '2022-04-01'), ('1517-12-31', '2021-12-31'), ('1517-06-30', '2022-06-30'))) >>> ih <IndexHierarchyGO> 1517-04-01 2022-04-01 1517-12-31 2021-12-31 1517-06-30 2022-06-30 <<U10> <<U10> >>> ih.via_dt.fromisoformat() [[datetime.date(1517, 4, 1) datetime.date(2022, 4, 1)] [datetime.date(1517, 12, 31) datetime.date(2021, 12, 31)] [datetime.date(1517, 6, 30) datetime.date(2022, 6, 30)]]
- IndexHierarchyGO.via_dt.strftime(format)
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.strftime(format)[source]
Return a string representing the date, controlled by an explicit
format
string.
>>> import datetime >>> ih = sf.IndexHierarchyGO.from_labels(((datetime.datetime(1517, 1, 1), datetime.datetime(2022, 4, 1, 8, 30, 59)), (datetime.datetime(1517, 4, 1), datetime.datetime(2022, 12, 31, 8, 30, 59)))) >>> ih <IndexHierarchyGO> 1517-01-01 00:00:00 2022-04-01 08:30:59 1517-04-01 00:00:00 2022-12-31 08:30:59 <object> <object> >>> ih.via_dt.strftime("%A | %B") [['Monday | January' 'Friday | April'] ['Sunday | April' 'Saturday | December']]
- IndexHierarchyGO.via_dt.strptime(format)
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.strptime(format)[source]
Return a Python datetime object from parsing a string defined with
format
.
>>> ih = sf.IndexHierarchyGO.from_labels((('4/1/1517', '4/1/2022'), ('12/31/1517', '12/31/2021'), ('6/30/1517', '6/30/2022'))) >>> ih <IndexHierarchyGO> 4/1/1517 4/1/2022 12/31/1517 12/31/2021 6/30/1517 6/30/2022 <<U10> <<U10> >>> ih.via_dt.strptime("%m/%d/%Y") [[datetime.datetime(1517, 4, 1, 0, 0) datetime.datetime(2022, 4, 1, 0, 0)] [datetime.datetime(1517, 12, 31, 0, 0) datetime.datetime(2021, 12, 31, 0, 0)] [datetime.datetime(1517, 6, 30, 0, 0) datetime.datetime(2022, 6, 30, 0, 0)]]
- IndexHierarchyGO.via_dt.strpdate(format)
- IndexHierarchyGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.strpdate(format)[source]
Return a Python date object from parsing a string defined with
format
.
>>> ih = sf.IndexHierarchyGO.from_labels((('4/1/1517', '4/1/2022'), ('12/31/1517', '12/31/2021'), ('6/30/1517', '6/30/2022'))) >>> ih <IndexHierarchyGO> 4/1/1517 4/1/2022 12/31/1517 12/31/2021 6/30/1517 6/30/2022 <<U10> <<U10> >>> ih.via_dt.strpdate("%m/%d/%Y") [[datetime.date(1517, 4, 1) datetime.date(2022, 4, 1)] [datetime.date(1517, 12, 31) datetime.date(2021, 12, 31)] [datetime.date(1517, 6, 30) datetime.date(2022, 6, 30)]]
IndexHierarchyGO: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic