Detail: IndexGO: Accessor Datetime¶
Overview: IndexGO: Accessor Datetime
- IndexGO.via_dt.__call__(*, fill_value)
- IndexGO.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.
>>> ix = sf.IndexGO(('1517-01-01', '', '1517-12-31', '1517-06-30')) >>> ix.via_dt(fill_value=-1).day RuntimeError('invalid dtype (<U10) for date operation')
- IndexGO.via_dt.year
- IndexGO.via_dt
Interface for applying datetime properties and methods to elements in this container.
- InterfaceDatetime.year
Return the year of each element.
>>> import datetime >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.year [1517 1517]
- IndexGO.via_dt.year_month
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.year_month ['1517-01' '1517-04']
- IndexGO.via_dt.month
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.month [1 4]
- IndexGO.via_dt.day
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.day [1 1]
- IndexGO.via_dt.hour
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.hour [0 8]
- IndexGO.via_dt.minute
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.minute [ 0 30]
- IndexGO.via_dt.second
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.second [ 0 59]
- IndexGO.via_dt.weekday
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.weekday() [0 6]
- IndexGO.via_dt.quarter
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.quarter() [1 2]
- IndexGO.via_dt.is_month_end
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.is_month_end() [False False]
- IndexGO.via_dt.is_month_start
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.is_month_start() [ True True]
- IndexGO.via_dt.is_year_end
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.is_year_end() [False False]
- IndexGO.via_dt.is_year_start
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.is_year_start() [ True False]
- IndexGO.via_dt.is_quarter_end
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.is_quarter_end() [False False]
- IndexGO.via_dt.is_quarter_start
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.is_quarter_start() [ True True]
- IndexGO.via_dt.timetuple
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.timetuple() [time.struct_time(tm_year=1517, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=1, tm_isdst=-1) time.struct_time(tm_year=1517, tm_mon=4, tm_mday=1, tm_hour=8, tm_min=30, tm_sec=59, tm_wday=6, tm_yday=91, tm_isdst=-1)]
- IndexGO.via_dt.isoformat(sep, timespec)
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.isoformat() ['1517-01-01T00:00:00' '1517-04-01T08:30:59']
- IndexGO.via_dt.fromisoformat
- IndexGO.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.
>>> ix = sf.IndexGO(('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30', '1517-10-01')) >>> ix.via_dt.fromisoformat() [datetime.date(1517, 1, 1) datetime.date(1517, 4, 1) datetime.date(1517, 12, 31) datetime.date(1517, 6, 30) datetime.date(1517, 10, 1)]
- IndexGO.via_dt.strftime(format)
- IndexGO.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 >>> ix = sf.IndexGO((datetime.datetime(1517, 1, 1), datetime.datetime(1517, 4, 1, 8, 30, 59))) >>> ix.via_dt.strftime("%A | %B") ['Monday | January' 'Sunday | April']
- IndexGO.via_dt.strptime(format)
- IndexGO.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
.
>>> ix = sf.IndexGO(('1/1/1517', '4/1/1517', '6/30/1517')) >>> ix.via_dt.strptime("%m/%d/%Y") [datetime.datetime(1517, 1, 1, 0, 0) datetime.datetime(1517, 4, 1, 0, 0) datetime.datetime(1517, 6, 30, 0, 0)]
- IndexGO.via_dt.strpdate(format)
- IndexGO.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
.
>>> ix = sf.IndexGO(('1/1/1517', '4/1/1517', '6/30/1517')) >>> ix.via_dt.strpdate("%m/%d/%Y") [datetime.date(1517, 1, 1) datetime.date(1517, 4, 1) datetime.date(1517, 6, 30)]
IndexGO: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Regular Expression | Accessor Hashlib