A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pandas.pydata.org/docs/reference/api/pandas.arrays.IntervalArray.to_tuples.html below:

pandas.arrays.IntervalArray.to_tuples — pandas 2.3.1 documentation

pandas.arrays.IntervalArray.to_tuples#
IntervalArray.to_tuples(na_tuple=True)[source]#

Return an ndarray (if self is IntervalArray) or Index (if self is IntervalIndex) of tuples of the form (left, right).

Parameters:
na_tuplebool, default True

If True, return NA as a tuple (nan, nan). If False, just return NA as nan.

Returns:
tuples: ndarray (if self is IntervalArray) or Index (if self is IntervalIndex)

Examples

For pandas.IntervalArray:

>>> idx = pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 2)])
>>> idx
<IntervalArray>
[(0, 1], (1, 2]]
Length: 2, dtype: interval[int64, right]
>>> idx.to_tuples()
array([(0, 1), (1, 2)], dtype=object)

For pandas.IntervalIndex:

>>> idx = pd.interval_range(start=0, end=2)
>>> idx
IntervalIndex([(0, 1], (1, 2]], dtype='interval[int64, right]')
>>> idx.to_tuples()
Index([(0, 1), (1, 2)], dtype='object')

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4