Detail: IndexNanosecondGO: Method

Overview: IndexNanosecondGO: Method

IndexNanosecondGO.__array__(dtype=None)

Support the __array__ interface, returning an array of values.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.__array__()
['1789-05-05T00:00:00.000000000' '1789-12-31T00:00:00.000000000'
 '1799-11-09T00:00:00.000000000']
IndexNanosecondGO.__array_ufunc__(ufunc, method, *args, **kwargs)

Support for NumPy elements or arrays on the left hand of binary operators.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> np.array((0, 1, 0)) * ix
UFuncTypeError(<ufunc 'multiply'>, (dtype('int64'), dtype('<M8[ns]')))
IndexNanosecondGO.__bool__()

Raises ValueError to prohibit ambiguous use of truthy evaluation.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> bool(ix)
ErrorNotTruthy('The truth value of a container is ambiguous. For a truthy indicator of non-empty status, use the `size` attribute.')
IndexNanosecondGO.__copy__()

Return shallow copy of this Index.

>>> import copy
>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> copy.copy(ix)
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.__deepcopy__(memo)
>>> import copy
>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> copy.deepcopy(ix)
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.__len__()
>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> len(ix)
3
IndexNanosecondGO.all(axis=0, skipna=True, out=None)

Logical and over values along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.all()
True
IndexNanosecondGO.any(axis=0, skipna=True, out=None)

Logical or over values along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.any()
True
IndexNanosecondGO.append(value)

Specialize for fixed-typed indices: convert value argument; do not need to resolve_dtype with each addition; self._map is never None

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.append('f')
ValueError('Error parsing datetime string "f" at position 0')
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.astype(dtype)

Return an Index with type determined by dtype argument. If a datetime64 dtype is provided, the appropriate Index subclass will be returned. Note that for Index, this is a simple function, whereas for IndexHierarchy, this is an interface exposing both a callable and a getitem interface.

Parameters:

dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.astype(str)
<IndexGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<<U48>
IndexNanosecondGO.copy()

Return shallow copy of this Index.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.copy()
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.cumprod(axis=0, skipna=True)

Return the cumulative product over the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.cumprod()
UFuncTypeError(<ufunc 'multiply'>, (dtype('<M8[ns]'), dtype('<M8[ns]')))
IndexNanosecondGO.cumsum(axis=0, skipna=True)

Return the cumulative sum over the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.cumsum()
UFuncTypeError(<ufunc 'add'>, (dtype('<M8[ns]'), dtype('<M8[ns]')))
IndexNanosecondGO.difference(*others)

Perform difference with another Index, container, or NumPy array. Retains order.

>>> ix1 = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix1
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix2 = sf.IndexNanosecondGO(('2022-04-01', '2021-12-31', '2022-06-30'))
>>> ix2
<IndexNanosecondGO>
2022-04-01T00:00:00.000000000
2021-12-31T00:00:00.000000000
2022-06-30T00:00:00.000000000
<datetime64[ns]>
>>> ix1.difference(ix2)
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.dropfalsy()

Return a new Index after removing values of NaN or None.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', 'NaT', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
NaT
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.dropfalsy()
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.dropna()

Return a new Index after removing values of NaN or None.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', 'NaT', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
NaT
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.dropna()
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.equals(other, *, compare_name=False, compare_dtype=False, compare_class=False, skipna=True)

Return a bool from comparison to any other object.

Parameters:
  • compare_name – Include equality of the container’s name (and all composed containers) in the comparison.

  • compare_dtype – Include equality of the container’s dtype (and all composed containers) in the comparison.

  • compare_class – Include equality of the container’s class (and all composed containers) in the comparison.

  • skipna – If True, comparisons between missing values are equal.

>>> ix1 = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix1
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix2 = sf.IndexNanosecondGO(('2022-04-01', '2021-12-31', '2022-06-30'))
>>> ix2
<IndexNanosecondGO>
2022-04-01T00:00:00.000000000
2021-12-31T00:00:00.000000000
2022-06-30T00:00:00.000000000
<datetime64[ns]>
>>> ix1.equals(ix2)
False
IndexNanosecondGO.extend(values)

Append multiple values :param values: can be a generator.

>>> ix1 = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix1
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix2 = sf.IndexNanosecondGO(('2022-04-01', '2021-12-31', '2022-06-30'))
>>> ix2
<IndexNanosecondGO>
2022-04-01T00:00:00.000000000
2021-12-31T00:00:00.000000000
2022-06-30T00:00:00.000000000
<datetime64[ns]>
>>> ix1.extend(ix2)
>>> ix1
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
2022-04-01T00:00:00.000000000
2021-12-31T00:00:00.000000000
2022-06-30T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.fillfalsy(value)

Return an Index with replacing falsy values with the supplied value.

Parameters:

value – Value to be used to replace missing values (NaN or None).

>>> ix = sf.IndexNanosecondGO(('1789-05-05', 'NaT', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
NaT
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.fillfalsy('A')
ValueError('Error parsing datetime string "A" at position 0')
IndexNanosecondGO.fillna(value)

Return an Index with replacing null (NaN or None) with the supplied value.

Parameters:

value – Value to be used to replace missing values (NaN or None).

>>> ix = sf.IndexNanosecondGO(('1789-05-05', 'NaT', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
NaT
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.fillna(0)
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1970-01-01T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.head(count=5)

Return a Index consisting only of the top elements as specified by count.

Parameters:

count – Number of elements to be returned from the top of the Index

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.head(2)
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.iloc_searchsorted(values, *, side_left=True)

Given a sorted Series, return the iloc (integer) position(s) at which insertion in values would retain sort order.

Parameters:
  • values – a single value, or iterable of values.

  • side_left – If True, the index of the first suitable location found is given, else return the last such index. If matching an existing value, side_left==True will return that position, side_left==Right will return the next position (or the length).

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.iloc_searchsorted('c')
ValueError('Error parsing datetime string "c" at position 0')
IndexNanosecondGO.intersection(*others)

Perform intersection with one or many Index, container, or NumPy array. Identical comparisons retain order.

>>> ix1 = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix1
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix2 = sf.IndexNanosecondGO(('2022-04-01', '2021-12-31', '2022-06-30'))
>>> ix2
<IndexNanosecondGO>
2022-04-01T00:00:00.000000000
2021-12-31T00:00:00.000000000
2022-06-30T00:00:00.000000000
<datetime64[ns]>
>>> ix1.intersection(ix2)
<IndexNanosecondGO>
<datetime64[ns]>
IndexNanosecondGO.isin(other)

Return a Boolean array showing True where a label is found in other. If other is a multidimensional array, it is flattened.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.isin(('1789-05-05',))
[False False False]
IndexNanosecondGO.label_widths_at_depth(depth_level=0)

A generator of pairs, where each pair is the label and the contiguous count of that label found at the depth specified by depth_level.

Parameters:

depth_level – a depth level, starting from zero.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> tuple(ix.label_widths_at_depth(0))
((numpy.datetime64('1789-05-05T00:00:00.000000000'), 1), (numpy.datetime64('1789-12-31T00:00:00.000000000'), 1), (numpy.datetime64('1799-11-09T00:00:00.000000000'), 1))
IndexNanosecondGO.level_add(level, *, index_constructor=None)

Return an IndexHierarchy with an added root level.

Parameters:
  • level – A hashable to used as the new root.

  • *

  • index_constructor

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.level_add('A')
<IndexHierarchyGO>
A                  1789-05-05T00:00:...
A                  1789-12-31T00:00:...
A                  1799-11-09T00:00:...
<<U1>              <datetime64[ns]>
IndexNanosecondGO.loc_searchsorted(values, *, side_left=True, fill_value=nan)

Given a sorted Series, return the loc (label) position(s) at which insertion in values would retain sort order.

Parameters:
  • values – a single value, or iterable of values.

  • side_left – If True, the index of the first suitable location found is given, else return the last such index. If matching an existing value, side_left==True will return that position, side_left==Right will return the next position (or the length).

  • fill_value – A value to be used to fill the label beyond the last label.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.loc_searchsorted('c')
ValueError('Error parsing datetime string "c" at position 0')
IndexNanosecondGO.loc_to_iloc(key)

Given a label (loc) style key (either a label, a list of labels, a slice, or a Boolean selection), return the index position (iloc) style key. Keys that are not found will raise a KeyError or a sf.LocInvalid error.

Parameters:

key – a label key.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.loc_to_iloc('d')
ValueError('Error parsing datetime string "d" at position 0')
>>> ix.loc_to_iloc(['a', 'e'])
ValueError('Cannot create a NumPy datetime other than NaT with generic units')
>>> ix.loc_to_iloc(slice('c', None))
ValueError('Error parsing datetime string "c" at position 0')
IndexNanosecondGO.max(axis=0, skipna=True)

Return the maximum along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.max()
1799-11-09T00:00:00.000000000
IndexNanosecondGO.mean(axis=0, skipna=True, out=None)

Return the mean along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.mean()
UFuncTypeError(<ufunc 'add'>, (dtype('<M8[ns]'), dtype('<M8[ns]')))
IndexNanosecondGO.median(axis=0, skipna=True, out=None)

Return the median along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.median()
UFuncTypeError(<ufunc 'add'>, (dtype('<M8[ns]'), dtype('<M8[ns]')))
IndexNanosecondGO.min(axis=0, skipna=True, out=None)

Return the minimum along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.min()
1789-05-05T00:00:00.000000000
IndexNanosecondGO.prod(axis=0, skipna=True, allna=1, out=None)

Return the product along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.prod()
UFuncTypeError(<ufunc 'multiply'>, (dtype('<M8[ns]'), dtype('<M8[ns]')))
IndexNanosecondGO.relabel(mapper)

Return a new Index with labels replaced by the callable or mapping; order will be retained. If a mapping is used, the mapping need not map all origin keys.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.relabel(lambda l: l.astype('<M8[ms]').astype(object).day)
<IndexNanosecondGO>
1970-01-01T00:00:00.000000005
1970-01-01T00:00:00.000000031
1970-01-01T00:00:00.000000009
<datetime64[ns]>
IndexNanosecondGO.rename(name)

Return a new Frame with an updated name attribute.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.rename('y')
<IndexNanosecondGO: y>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.roll(shift)

Return an Index with values rotated forward and wrapped around (with a postive shift) or backward and wrapped around (with a negative shift).

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.roll(2)
<IndexNanosecondGO>
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
1789-05-05T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.sample(count=1, *, seed=None)

Randomly (optionally made deterministic with a fixed seed) extract items from the container to return a subset of the container.

Parameters:
  • select. (Number of elements to) –

  • selection. (Initial state of random) –

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.sample(2, seed=0)
<IndexNanosecondGO>
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.sort(ascending=True, kind='mergesort', key=None)

Return a new Index with the labels sorted.

Parameters:
  • ascending – If True, sort in ascending order; if False, sort in descending order.

  • kind – Name of the sort algorithm as passed to NumPy.

  • key – A function that is used to pre-process the selected columns or rows and derive new values to sort by.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.sort()
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.sort(ascending=False)
<IndexNanosecondGO>
1799-11-09T00:00:00.000000000
1789-12-31T00:00:00.000000000
1789-05-05T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.std(axis=0, skipna=True, ddof=0, out=None)

Return the standard deviaton along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.std()
UFuncTypeError(<ufunc 'add'>, (dtype('<M8[ns]'), dtype('<M8[ns]')))
IndexNanosecondGO.sum(axis=0, skipna=True, allna=0, out=None)

Sum values along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.sum()
UFuncTypeError(<ufunc 'add'>, (dtype('<M8[ns]'), dtype('<M8[ns]')))
IndexNanosecondGO.tail(count=5)

Return a Index consisting only of the bottom elements as specified by count.

Parameters:

count – Number of elements to be returned from the bottom of the Index

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.tail(2)
<IndexNanosecondGO>
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.union(*others)

Perform union with another Index, container, or NumPy array. Identical comparisons retain order.

>>> ix1 = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix1
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix2 = sf.IndexNanosecondGO(('2022-04-01', '2021-12-31', '2022-06-30'))
>>> ix2
<IndexNanosecondGO>
2022-04-01T00:00:00.000000000
2021-12-31T00:00:00.000000000
2022-06-30T00:00:00.000000000
<datetime64[ns]>
>>> ix1.union(ix2)
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
2021-12-31T00:00:00.000000000
2022-04-01T00:00:00.000000000
2022-06-30T00:00:00.000000000
<datetime64[ns]>
IndexNanosecondGO.unique(depth_level=0, order_by_occurrence=False)

Return a NumPy array of unique values.

Parameters:
  • depth_level – defaults to 0 for for a 1D Index.

  • order_by_occurrence – for 1D indices, this argument is a no-op. Provided for compatibility with IndexHierarchy.

Returns:

numpy.ndarray

>>> ix = sf.IndexNanosecondGO(('1789-05-05', 'NaT', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
NaT
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.unique()
['1789-05-05T00:00:00.000000000'                           'NaT'
 '1799-11-09T00:00:00.000000000']
IndexNanosecondGO.values_at_depth(depth_level=0)

Return an NP array for the depth_level specified.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.values_at_depth(0)
['1789-05-05T00:00:00.000000000' '1789-12-31T00:00:00.000000000'
 '1799-11-09T00:00:00.000000000']
IndexNanosecondGO.var(axis=0, skipna=True, ddof=0, out=None)

Return the variance along the specified axis.

Parameters:
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

>>> ix = sf.IndexNanosecondGO(('1789-05-05', '1789-12-31', '1799-11-09'))
>>> ix
<IndexNanosecondGO>
1789-05-05T00:00:00.000000000
1789-12-31T00:00:00.000000000
1799-11-09T00:00:00.000000000
<datetime64[ns]>
>>> ix.var()
UFuncTypeError(<ufunc 'add'>, (dtype('<M8[ns]'), dtype('<M8[ns]')))

IndexNanosecondGO: 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