Detail: IndexNanosecond: Accessor Datetime

Overview: IndexNanosecond: Accessor Datetime

IndexNanosecond.via_dt.__call__(*, fill_value)
IndexNanosecond.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.IndexNanosecond(('1789-05-05', 'NaT', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
NaT
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt(fill_value=-1).year
[1789   -1 1799]
IndexNanosecond.via_dt.year
IndexNanosecond.via_dt

Interface for applying datetime properties and methods to elements in this container.

InterfaceDatetime.year

Return the year of each element.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.year
[1789 1789 1799]
IndexNanosecond.via_dt.year_month
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.year_month
['1789-05' '1789-12' '1799-11']
IndexNanosecond.via_dt.month
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.month
[ 5 12 11]
IndexNanosecond.via_dt.day
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.day
[ 5 31  9]
IndexNanosecond.via_dt.hour
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.hour
[0 0 0]
IndexNanosecond.via_dt.minute
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.minute
[0 0 0]
IndexNanosecond.via_dt.second
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.second
[0 0 0]
IndexNanosecond.via_dt.weekday
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.weekday()
[1 3 5]
IndexNanosecond.via_dt.quarter
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.quarter()
[2 4 4]
IndexNanosecond.via_dt.is_month_end
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.is_month_end()
[False  True False]
IndexNanosecond.via_dt.is_month_start
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.is_month_start()
[False False False]
IndexNanosecond.via_dt.is_year_end
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.is_year_end()
[False  True False]
IndexNanosecond.via_dt.is_year_start
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.is_year_start()
[False False False]
IndexNanosecond.via_dt.is_quarter_end
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.is_quarter_end()
[False  True False]
IndexNanosecond.via_dt.is_quarter_start
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.is_quarter_start()
[False False False]
IndexNanosecond.via_dt.timetuple
IndexNanosecond.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().

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.timetuple()
RuntimeError('invalid dtype (datetime64[ns]) for date operation')
IndexNanosecond.via_dt.isoformat(sep, timespec)
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.isoformat()
RuntimeError('invalid dtype (datetime64[ns]) for date operation')
IndexNanosecond.via_dt.fromisoformat
IndexNanosecond.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.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.fromisoformat()
RuntimeError('invalid dtype (datetime64[ns]) for operation on string types')
IndexNanosecond.via_dt.strftime(format)
IndexNanosecond.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.

>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.strftime("%A | %B")
RuntimeError('invalid dtype (datetime64[ns]) for date operation')
IndexNanosecond.via_dt.strptime(format)
IndexNanosecond.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.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.strptime("%m/%d/%Y")
RuntimeError('invalid dtype (datetime64[ns]) for operation on string types')
IndexNanosecond.via_dt.strpdate(format)
IndexNanosecond.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.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecond>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.via_dt.strpdate("%m/%d/%Y")
RuntimeError('invalid dtype (datetime64[ns]) for operation on string types')

IndexNanosecond: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic