modin.pandas.Series.to_numpy¶
- Series.to_numpy(dtype=None, copy=False, na_value=_NoDefault.no_default, **kwargs) ndarray[source]¶
A NumPy ndarray representing the values in this Series or Index.
- Parameters:
dtype (str or numpy.dtype, optional) – The dtype to pass to
numpy.asarray().copy (bool, default False) – This argument is ignored in Snowflake backend. The data from Snowflake will be retrieved into the client, and a numpy array containing this data will be returned.
na_value (Any, optional) – The value to use for missing values. The default value depends on dtype and the type of the array.
**kwargs – Additional keywords passed through to the
to_numpymethod of the underlying array (for extension arrays).
- Return type:
numpy.ndarray
See also
Series.arrayGet the actual data stored within.
Index.arrayGet the actual data stored within.
DataFrame.to_numpySimilar method for DataFrame.
Notes
The returned array will be the same up to equality (values equal in self will be equal in the returned array; likewise for values that are not equal). When self contains an ExtensionArray, the dtype may be different. For example, for a category-dtype Series, to_numpy() will return a NumPy array and the categorical dtype will be lost.
This table lays out the different dtypes and default return types of to_numpy() for various dtypes within pandas.
dtype
array type
category[T]
ndarray[T] (same dtype as input)
period
ndarray[object] (Periods)
interval
ndarray[object] (Intervals)
IntegerNA
ndarray[object]
datetime64[ns]
datetime64[ns]
datetime64[ns, tz]
ndarray[object] (Timestamps)
Examples
Specify the dtype to control how datetime-aware data is represented. Use dtype=object to return an ndarray of pandas Timestamp objects, each with the correct tz.
Or dtype=’datetime64[ns]’ to return an ndarray of native datetime64 values. The values are converted to UTC and the timezone info is dropped.