Detail: Batch: Accessor DatetimeΒΆ

Overview: Batch: Accessor Datetime

Batch.via_dt.year
Batch.via_dt

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

InterfaceBatchDatetime.year

Return the year of each element.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.year.to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     1517    2022
i                q     1517    2021
i                r     1517    2022
j                p     1620    1976
j                q     1620    1954
j                r     1620    1976
<<U1>            <<U1> <int64> <int64>
Batch.via_dt.year_month
Batch.via_dt

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

InterfaceBatchDatetime.year_month

Return the month of each element, between 1 and 12 inclusive.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.year_month.to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     1517-04 2022-04
i                q     1517-12 2021-12
i                r     1517-06 2022-06
j                p     1620-04 1976-04
j                q     1620-12 1954-12
j                r     1620-06 1976-06
<<U1>            <<U1> <<U7>   <<U7>
Batch.via_dt.month
Batch.via_dt

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

InterfaceBatchDatetime.month

Return the month of each element, between 1 and 12 inclusive.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.month.to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     4       4
i                q     12      12
i                r     6       6
j                p     4       4
j                q     12      12
j                r     6       6
<<U1>            <<U1> <int64> <int64>
Batch.via_dt.day
Batch.via_dt

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

InterfaceBatchDatetime.day

Return the day of each element, between 1 and the number of days in the given month of the given year.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.day.to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     1       1
i                q     31      31
i                r     30      30
j                p     1       1
j                q     31      31
j                r     30      30
<<U1>            <<U1> <int64> <int64>
Batch.via_dt.hour
Batch.via_dt

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

InterfaceBatchDatetime.hour

Return the hour of each element, between 0 and 24.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.hour.to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     0       0
i                q     0       0
i                r     0       0
j                p     0       0
j                q     0       0
j                r     0       0
<<U1>            <<U1> <int64> <int64>
Batch.via_dt.minute
Batch.via_dt

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

InterfaceBatchDatetime.minute

Return the minute of each element, between 0 and 60.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.minute.to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     0       0
i                q     0       0
i                r     0       0
j                p     0       0
j                q     0       0
j                r     0       0
<<U1>            <<U1> <int64> <int64>
Batch.via_dt.second
Batch.via_dt

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

InterfaceBatchDatetime.second

Return the second of each element, between 0 and 60.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.second.to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     0       0
i                q     0       0
i                r     0       0
j                p     0       0
j                q     0       0
j                r     0       0
<<U1>            <<U1> <int64> <int64>
Batch.via_dt.weekday
Batch.via_dt

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

InterfaceBatchDatetime.weekday()[source]

Return the day of the week as an integer, where Monday is 0 and Sunday is 6.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.weekday().to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     6       4
i                q     0       4
i                r     5       3
j                p     2       3
j                q     3       4
j                r     1       2
<<U1>            <<U1> <int64> <int64>
Batch.via_dt.quarter
Batch.via_dt

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

InterfaceBatchDatetime.quarter()[source]

Return the quarter of the year as an integer, where January through March is quarter 1.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.quarter().to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     2       2
i                q     4       4
i                r     2       2
j                p     2       2
j                q     4       4
j                r     2       2
<<U1>            <<U1> <int64> <int64>
Batch.via_dt.is_month_end
Batch.via_dt

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

InterfaceBatchDatetime.is_month_end()[source]

Return Boolean indicators if the day is the month end.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.is_month_end().to_frame()
<Frame>
<Index>                a      b      <<U1>
<IndexHierarchy>
i                p     False  False
i                q     True   True
i                r     True   True
j                p     False  False
j                q     True   True
j                r     True   True
<<U1>            <<U1> <bool> <bool>
Batch.via_dt.is_month_start
Batch.via_dt

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

InterfaceBatchDatetime.is_month_start()[source]

Return Boolean indicators if the day is the month start.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.is_month_start().to_frame()
<Frame>
<Index>                a      b      <<U1>
<IndexHierarchy>
i                p     True   True
i                q     False  False
i                r     False  False
j                p     True   True
j                q     False  False
j                r     False  False
<<U1>            <<U1> <bool> <bool>
Batch.via_dt.is_year_end
Batch.via_dt

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

InterfaceBatchDatetime.is_year_end()[source]

Return Boolean indicators if the day is the year end.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.is_year_end().to_frame()
<Frame>
<Index>                a      b      <<U1>
<IndexHierarchy>
i                p     False  False
i                q     True   True
i                r     False  False
j                p     False  False
j                q     True   True
j                r     False  False
<<U1>            <<U1> <bool> <bool>
Batch.via_dt.is_year_start
Batch.via_dt

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

InterfaceBatchDatetime.is_year_start()[source]

Return Boolean indicators if the day is the year start.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.is_year_start().to_frame()
<Frame>
<Index>                a      b      <<U1>
<IndexHierarchy>
i                p     False  False
i                q     False  False
i                r     False  False
j                p     False  False
j                q     False  False
j                r     False  False
<<U1>            <<U1> <bool> <bool>
Batch.via_dt.is_quarter_end
Batch.via_dt

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

InterfaceBatchDatetime.is_quarter_end()[source]

Return Boolean indicators if the day is the quarter end.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.is_quarter_end().to_frame()
<Frame>
<Index>                a      b      <<U1>
<IndexHierarchy>
i                p     False  False
i                q     True   True
i                r     True   True
j                p     False  False
j                q     True   True
j                r     True   True
<<U1>            <<U1> <bool> <bool>
Batch.via_dt.is_quarter_start
Batch.via_dt

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

InterfaceBatchDatetime.is_quarter_start()[source]

Return Boolean indicators if the day is the quarter start.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.is_quarter_start().to_frame()
<Frame>
<Index>                a      b      <<U1>
<IndexHierarchy>
i                p     True   True
i                q     False  False
i                r     False  False
j                p     True   True
j                q     False  False
j                r     False  False
<<U1>            <<U1> <bool> <bool>
Batch.via_dt.timetuple
Batch.via_dt

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

InterfaceBatchDatetime.timetuple()[source]

Return a time.struct_time such as returned by time.localtime().

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.timetuple().to_frame()
<Frame>
<Index>                a                    b                    <<U1>
<IndexHierarchy>
i                p     time.struct_time(... time.struct_time(...
i                q     time.struct_time(... time.struct_time(...
i                r     time.struct_time(... time.struct_time(...
j                p     time.struct_time(... time.struct_time(...
j                q     time.struct_time(... time.struct_time(...
j                r     time.struct_time(... time.struct_time(...
<<U1>            <<U1> <object>             <object>
Batch.via_dt.isoformat(sep, timespec)
Batch.via_dt

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

InterfaceBatchDatetime.isoformat(sep='T', timespec='auto')[source]

Return a string representing the date in ISO 8601 format, YYYY-MM-DD.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.isoformat().to_frame()
<Frame>
<Index>                a          b          <<U1>
<IndexHierarchy>
i                p     1517-04-01 2022-04-01
i                q     1517-12-31 2021-12-31
i                r     1517-06-30 2022-06-30
j                p     1620-04-01 1976-04-01
j                q     1620-12-31 1954-12-31
j                r     1620-06-30 1976-06-30
<<U1>            <<U1> <<U10>     <<U10>
Batch.via_dt.fromisoformat
Batch.via_dt

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

InterfaceBatchDatetime.fromisoformat()[source]

Return a datetime.date object from an ISO 8601 format.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'))), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b')))))
>>> bt.via_dt.fromisoformat().to_frame()
<Frame>
<Index>                a          b          <<U1>
<IndexHierarchy>
i                p     1517-04-01 2022-04-01
i                q     1517-12-31 2021-12-31
i                r     1517-06-30 2022-06-30
j                p     1620-04-01 1976-04-01
j                q     1620-12-31 1954-12-31
j                r     1620-06-30 1976-06-30
<<U1>            <<U1> <object>   <object>
Batch.via_dt.strftime(format)
Batch.via_dt

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

InterfaceBatchDatetime.strftime(format)[source]

Return a string representing the date, controlled by an explicit format string.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('1517-04-01', '1517-12-31', '1517-06-30'), ('2022-04-01', '2021-12-31', '2022-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64)), ('j', sf.Frame.from_fields((('1620-04-01', '1620-12-31', '1620-06-30'), ('1976-04-01', '1954-12-31', '1976-06-30')), index=('p', 'q', 'r'), columns=('a', 'b'), dtypes=np.datetime64))))
>>> bt.via_dt.strftime("%A | %B").to_frame()
<Frame>
<Index>                a                   b                 <<U1>
<IndexHierarchy>
i                p     Sunday | April      Friday | April
i                q     Monday | December   Friday | December
i                r     Saturday | June     Thursday | June
j                p     Wednesday | April   Thursday | April
j                q     Thursday | December Friday | December
j                r     Tuesday | June      Wednesday | June
<<U1>            <<U1> <<U19>              <<U17>
Batch.via_dt.strptime(format)
Batch.via_dt

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

InterfaceBatchDatetime.strptime(format)[source]

Return a Python datetime object from parsing a string defined with format.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('4/1/1517', '12/31/1517', '6/30/1517'), ('4/1/2022', '12/31/2021', '6/30/2022')), index=('p', 'q', 'r'), columns=('a', 'b'))), ('j', sf.Frame.from_fields((('4/1/1620', '12/31/1620', '6/30/1620'), ('4/1/1976', '12/31/1954', '6/30/1976')), index=('p', 'q', 'r'), columns=('a', 'b')))))
>>> bt.via_dt.strptime("%m/%d/%Y").to_frame()
<Frame>
<Index>                a                   b                   <<U1>
<IndexHierarchy>
i                p     1517-04-01 00:00:00 2022-04-01 00:00:00
i                q     1517-12-31 00:00:00 2021-12-31 00:00:00
i                r     1517-06-30 00:00:00 2022-06-30 00:00:00
j                p     1620-04-01 00:00:00 1976-04-01 00:00:00
j                q     1620-12-31 00:00:00 1954-12-31 00:00:00
j                r     1620-06-30 00:00:00 1976-06-30 00:00:00
<<U1>            <<U1> <object>            <object>
Batch.via_dt.strpdate(format)
Batch.via_dt

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

InterfaceBatchDatetime.strpdate(format)[source]

Return a Python date object from parsing a string defined with format.

>>> bt = sf.Batch((('i', sf.Frame.from_fields((('4/1/1517', '12/31/1517', '6/30/1517'), ('4/1/2022', '12/31/2021', '6/30/2022')), index=('p', 'q', 'r'), columns=('a', 'b'))), ('j', sf.Frame.from_fields((('4/1/1620', '12/31/1620', '6/30/1620'), ('4/1/1976', '12/31/1954', '6/30/1976')), index=('p', 'q', 'r'), columns=('a', 'b')))))
>>> bt.via_dt.strpdate("%m/%d/%Y").to_frame()
<Frame>
<Index>                a          b          <<U1>
<IndexHierarchy>
i                p     1517-04-01 2022-04-01
i                q     1517-12-31 2021-12-31
i                r     1517-06-30 2022-06-30
j                p     1620-04-01 1976-04-01
j                q     1620-12-31 1954-12-31
j                r     1620-06-30 1976-06-30
<<U1>            <<U1> <object>   <object>

Batch: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib