Examples
import numpy as np
import pandas as pd
s = pd.Series(pd.Categorical(['p', 'q', 'p']))
s.to_numpy()
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.
s = pd.Series(pd.date_range('2019', periods=4, tz="CET"))
s.to_numpy(dtype=object)
Or dtype='datetime64[ns]' to return an ndarray of native datetime64 values. The values are converted to UTC and
the timezone info is dropped.
s.to_numpy(dtype="datetime64[ns]")
# doctest: +ELLIPSIS