neulab/docprompting-conala huggingface dataset:
pandas.Series.dt.floor   Series.dt.floor(*args, **kwargs)[source]
 
Perform floor operation on the data to the specified freq.  Parameters 
 
freq:str or Offset


The frequency level to floor the index to. Must be a fixed frequency like ‘S’ (second) not ‘ME’ (month end). See frequency aliases for a list of possible freq values.  
ambiguous:‘infer’, bool-ndarray, ‘NaT’, default ‘raise’


Only relevant for DatetimeIndex:  ‘infer’ will attempt to infer fall dst-transition hours based on order bool-ndarray where True signifies a DST time, False designates a non-DST time (note that this flag is only applicable for ambiguous times) ‘NaT’ will return NaT where there are ambiguous times ‘raise’ will raise an AmbiguousTimeError if there are ambiguous times.   
nonexistent:‘shift_forward’, ‘shift_backward’, ‘NaT’, timedelta, default ‘raise’


A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.  ‘shift_forward’ will shift the nonexistent time forward to the closest existing time ‘shift_backward’ will shift the nonexistent time backward to the closest existing time ‘NaT’ will return NaT where there are nonexistent times timedelta objects will shift nonexistent times by the timedelta ‘raise’ will raise an NonExistentTimeError if there are nonexistent times.     Returns 
 DatetimeIndex, TimedeltaIndex, or Series

Index of the same type for a DatetimeIndex or TimedeltaIndex, or a Series with the same index for a Series.    Raises 
 ValueError if the freq cannot be converted.
   Notes If the timestamps have a timezone, flooring will take place relative to the local (“wall”) time and re-localized to the same timezone. When flooring near daylight savings time, use nonexistent and ambiguous to control the re-localization behavior. Examples DatetimeIndex 
>>> rng = pd.date_range('1/1/2018 11:59:00', periods=3, freq='min')
>>> rng
DatetimeIndex(['2018-01-01 11:59:00', '2018-01-01 12:00:00',
               '2018-01-01 12:01:00'],
              dtype='datetime64[ns]', freq='T')
>>> rng.floor('H')
DatetimeIndex(['2018-01-01 11:00:00', '2018-01-01 12:00:00',
               '2018-01-01 12:00:00'],
              dtype='datetime64[ns]', freq=None)
  Series 
>>> pd.Series(rng).dt.floor("H")
0   2018-01-01 11:00:00
1   2018-01-01 12:00:00
2   2018-01-01 12:00:00
dtype: datetime64[ns]
  When rounding near a daylight savings time transition, use ambiguous or nonexistent to control how the timestamp should be re-localized. 
>>> rng_tz = pd.DatetimeIndex(["2021-10-31 03:30:00"], tz="Europe/Amsterdam")
  
>>> rng_tz.floor("2H", ambiguous=False)
DatetimeIndex(['2021-10-31 02:00:00+01:00'],
             dtype='datetime64[ns, Europe/Amsterdam]', freq=None)
  
>>> rng_tz.floor("2H", ambiguous=True)
DatetimeIndex(['2021-10-31 02:00:00+02:00'],
              dtype='datetime64[ns, Europe/Amsterdam]', freq=None)
pandas.Series.dt.hour   Series.dt.hour
 
The hours of the datetime. Examples 
>>> datetime_series = pd.Series(
...     pd.date_range("2000-01-01", periods=3, freq="h")
... )
>>> datetime_series
0   2000-01-01 00:00:00
1   2000-01-01 01:00:00
2   2000-01-01 02:00:00
dtype: datetime64[ns]
>>> datetime_series.dt.hour
0    0
1    1
2    2
dtype: int64
pandas.Series.dt.is_leap_year   Series.dt.is_leap_year
 
Boolean indicator if the date belongs to a leap year. A leap year is a year, which has 366 days (instead of 365) including 29th of February as an intercalary day. Leap years are years which are multiples of four with the exception of years divisible by 100 but not by 400.  Returns 
 Series or ndarray

Booleans indicating if dates belong to a leap year.     Examples This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex. 
>>> idx = pd.date_range("2012-01-01", "2015-01-01", freq="Y")
>>> idx
DatetimeIndex(['2012-12-31', '2013-12-31', '2014-12-31'],
              dtype='datetime64[ns]', freq='A-DEC')
>>> idx.is_leap_year
array([ True, False, False])
  
>>> dates_series = pd.Series(idx)
>>> dates_series
0   2012-12-31
1   2013-12-31
2   2014-12-31
dtype: datetime64[ns]
>>> dates_series.dt.is_leap_year
0     True
1    False
2    False
dtype: bool
pandas.Series.dt.is_month_end   Series.dt.is_month_end
 
Indicates whether the date is the last day of the month.  Returns 
 Series or array

For Series, returns a Series with boolean values. For DatetimeIndex, returns a boolean array.      See also  is_month_start

Return a boolean indicating whether the date is the first day of the month.  is_month_end

Return a boolean indicating whether the date is the last day of the month.    Examples This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex. 
>>> s = pd.Series(pd.date_range("2018-02-27", periods=3))
>>> s
0   2018-02-27
1   2018-02-28
2   2018-03-01
dtype: datetime64[ns]
>>> s.dt.is_month_start
0    False
1    False
2    True
dtype: bool
>>> s.dt.is_month_end
0    False
1    True
2    False
dtype: bool
  
>>> idx = pd.date_range("2018-02-27", periods=3)
>>> idx.is_month_start
array([False, False, True])
>>> idx.is_month_end
array([False, True, False])
pandas.Series.dt.is_month_start   Series.dt.is_month_start
 
Indicates whether the date is the first day of the month.  Returns 
 Series or array

For Series, returns a Series with boolean values. For DatetimeIndex, returns a boolean array.      See also  is_month_start

Return a boolean indicating whether the date is the first day of the month.  is_month_end

Return a boolean indicating whether the date is the last day of the month.    Examples This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex. 
>>> s = pd.Series(pd.date_range("2018-02-27", periods=3))
>>> s
0   2018-02-27
1   2018-02-28
2   2018-03-01
dtype: datetime64[ns]
>>> s.dt.is_month_start
0    False
1    False
2    True
dtype: bool
>>> s.dt.is_month_end
0    False
1    True
2    False
dtype: bool
  
>>> idx = pd.date_range("2018-02-27", periods=3)
>>> idx.is_month_start
array([False, False, True])
>>> idx.is_month_end
array([False, True, False])
pandas.Series.dt.is_quarter_end   Series.dt.is_quarter_end
 
Indicator for whether the date is the last day of a quarter.  Returns 
 
is_quarter_end:Series or DatetimeIndex


The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.      See also  quarter

Return the quarter of the date.  is_quarter_start

Similar property indicating the quarter start.    Examples This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex. 
>>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
...                    periods=4)})
>>> df.assign(quarter=df.dates.dt.quarter,
...           is_quarter_end=df.dates.dt.is_quarter_end)
       dates  quarter    is_quarter_end
0 2017-03-30        1             False
1 2017-03-31        1              True
2 2017-04-01        2             False
3 2017-04-02        2             False
  
>>> idx = pd.date_range('2017-03-30', periods=4)
>>> idx
DatetimeIndex(['2017-03-30', '2017-03-31', '2017-04-01', '2017-04-02'],
              dtype='datetime64[ns]', freq='D')
  
>>> idx.is_quarter_end
array([False,  True, False, False])
pandas.Series.dt.is_quarter_start   Series.dt.is_quarter_start
 
Indicator for whether the date is the first day of a quarter.  Returns 
 
is_quarter_start:Series or DatetimeIndex


The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.      See also  quarter

Return the quarter of the date.  is_quarter_end

Similar property for indicating the quarter start.    Examples This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex. 
>>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
...                   periods=4)})
>>> df.assign(quarter=df.dates.dt.quarter,
...           is_quarter_start=df.dates.dt.is_quarter_start)
       dates  quarter  is_quarter_start
0 2017-03-30        1             False
1 2017-03-31        1             False
2 2017-04-01        2              True
3 2017-04-02        2             False
  
>>> idx = pd.date_range('2017-03-30', periods=4)
>>> idx
DatetimeIndex(['2017-03-30', '2017-03-31', '2017-04-01', '2017-04-02'],
              dtype='datetime64[ns]', freq='D')
  
>>> idx.is_quarter_start
array([False, False,  True, False])
pandas.Series.dt.is_year_end   Series.dt.is_year_end
 
Indicate whether the date is the last day of the year.  Returns 
 Series or DatetimeIndex

The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.      See also  is_year_start

Similar property indicating the start of the year.    Examples This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex. 
>>> dates = pd.Series(pd.date_range("2017-12-30", periods=3))
>>> dates
0   2017-12-30
1   2017-12-31
2   2018-01-01
dtype: datetime64[ns]
  
>>> dates.dt.is_year_end
0    False
1     True
2    False
dtype: bool
  
>>> idx = pd.date_range("2017-12-30", periods=3)
>>> idx
DatetimeIndex(['2017-12-30', '2017-12-31', '2018-01-01'],
              dtype='datetime64[ns]', freq='D')
  
>>> idx.is_year_end
array([False,  True, False])
pandas.Series.dt.is_year_start   Series.dt.is_year_start
 
Indicate whether the date is the first day of a year.  Returns 
 Series or DatetimeIndex

The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.      See also  is_year_end

Similar property indicating the last day of the year.    Examples This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex. 
>>> dates = pd.Series(pd.date_range("2017-12-30", periods=3))
>>> dates
0   2017-12-30
1   2017-12-31
2   2018-01-01
dtype: datetime64[ns]
  
>>> dates.dt.is_year_start
0    False
1    False
2    True
dtype: bool
  
>>> idx = pd.date_range("2017-12-30", periods=3)
>>> idx
DatetimeIndex(['2017-12-30', '2017-12-31', '2018-01-01'],
              dtype='datetime64[ns]', freq='D')
  
>>> idx.is_year_start
array([False, False,  True])
pandas.Series.dt.microsecond   Series.dt.microsecond
 
The microseconds of the datetime. Examples 
>>> datetime_series = pd.Series(
...     pd.date_range("2000-01-01", periods=3, freq="us")
... )
>>> datetime_series
0   2000-01-01 00:00:00.000000
1   2000-01-01 00:00:00.000001
2   2000-01-01 00:00:00.000002
dtype: datetime64[ns]
>>> datetime_series.dt.microsecond
0       0
1       1
2       2
dtype: int64
pandas.Series.dt.microseconds   Series.dt.microseconds
 
Number of microseconds (>= 0 and less than 1 second) for each element.
pandas.Series.dt.minute   Series.dt.minute
 
The minutes of the datetime. Examples 
>>> datetime_series = pd.Series(
...     pd.date_range("2000-01-01", periods=3, freq="T")
... )
>>> datetime_series
0   2000-01-01 00:00:00
1   2000-01-01 00:01:00
2   2000-01-01 00:02:00
dtype: datetime64[ns]
>>> datetime_series.dt.minute
0    0
1    1
2    2
dtype: int64
pandas.Series.dt.month   Series.dt.month
 
The month as January=1, December=12. Examples 
>>> datetime_series = pd.Series(
...     pd.date_range("2000-01-01", periods=3, freq="M")
... )
>>> datetime_series
0   2000-01-31
1   2000-02-29
2   2000-03-31
dtype: datetime64[ns]
>>> datetime_series.dt.month
0    1
1    2
2    3
dtype: int64
pandas.Series.dt.month_name   Series.dt.month_name(*args, **kwargs)[source]
 
Return the month names of the DateTimeIndex with specified locale.  Parameters 
 
locale:str, optional


Locale determining the language in which to return the month name. Default is English locale.    Returns 
 Index

Index of month names.     Examples 
>>> idx = pd.date_range(start='2018-01', freq='M', periods=3)
>>> idx
DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'],
              dtype='datetime64[ns]', freq='M')
>>> idx.month_name()
Index(['January', 'February', 'March'], dtype='object')
pandas.Series.dt.nanosecond   Series.dt.nanosecond
 
The nanoseconds of the datetime. Examples 
>>> datetime_series = pd.Series(
...     pd.date_range("2000-01-01", periods=3, freq="ns")
... )
>>> datetime_series
0   2000-01-01 00:00:00.000000000
1   2000-01-01 00:00:00.000000001
2   2000-01-01 00:00:00.000000002
dtype: datetime64[ns]
>>> datetime_series.dt.nanosecond
0       0
1       1
2       2
dtype: int64
pandas.Series.dt.nanoseconds   Series.dt.nanoseconds
 
Number of nanoseconds (>= 0 and less than 1 microsecond) for each element.
pandas.Series.dt.normalize   Series.dt.normalize(*args, **kwargs)[source]
 
Convert times to midnight. The time component of the date-time is converted to midnight i.e. 00:00:00. This is useful in cases, when the time does not matter. Length is unaltered. The timezones are unaffected. This method is available on Series with datetime values under the .dt accessor, and directly on Datetime Array/Index.  Returns 
 DatetimeArray, DatetimeIndex or Series

The same type as the original data. Series will have the same name and index. DatetimeIndex will have the same name.      See also  floor

Floor the datetimes to the specified freq.  ceil

Ceil the datetimes to the specified freq.  round

Round the datetimes to the specified freq.    Examples 
>>> idx = pd.date_range(start='2014-08-01 10:00', freq='H',
...                     periods=3, tz='Asia/Calcutta')
>>> idx
DatetimeIndex(['2014-08-01 10:00:00+05:30',
               '2014-08-01 11:00:00+05:30',
               '2014-08-01 12:00:00+05:30'],
                dtype='datetime64[ns, Asia/Calcutta]', freq='H')
>>> idx.normalize()
DatetimeIndex(['2014-08-01 00:00:00+05:30',
               '2014-08-01 00:00:00+05:30',
               '2014-08-01 00:00:00+05:30'],
               dtype='datetime64[ns, Asia/Calcutta]', freq=None)
pandas.Series.dt.quarter   Series.dt.quarter
 
The quarter of the date.
pandas.Series.dt.round   Series.dt.round(*args, **kwargs)[source]
 
Perform round operation on the data to the specified freq.  Parameters 
 
freq:str or Offset


The frequency level to round the index to. Must be a fixed frequency like ‘S’ (second) not ‘ME’ (month end). See frequency aliases for a list of possible freq values.  
ambiguous:‘infer’, bool-ndarray, ‘NaT’, default ‘raise’


Only relevant for DatetimeIndex:  ‘infer’ will attempt to infer fall dst-transition hours based on order bool-ndarray where True signifies a DST time, False designates a non-DST time (note that this flag is only applicable for ambiguous times) ‘NaT’ will return NaT where there are ambiguous times ‘raise’ will raise an AmbiguousTimeError if there are ambiguous times.   
nonexistent:‘shift_forward’, ‘shift_backward’, ‘NaT’, timedelta, default ‘raise’


A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.  ‘shift_forward’ will shift the nonexistent time forward to the closest existing time ‘shift_backward’ will shift the nonexistent time backward to the closest existing time ‘NaT’ will return NaT where there are nonexistent times timedelta objects will shift nonexistent times by the timedelta ‘raise’ will raise an NonExistentTimeError if there are nonexistent times.     Returns 
 DatetimeIndex, TimedeltaIndex, or Series

Index of the same type for a DatetimeIndex or TimedeltaIndex, or a Series with the same index for a Series.    Raises 
 ValueError if the freq cannot be converted.
   Notes If the timestamps have a timezone, rounding will take place relative to the local (“wall”) time and re-localized to the same timezone. When rounding near daylight savings time, use nonexistent and ambiguous to control the re-localization behavior. Examples DatetimeIndex 
>>> rng = pd.date_range('1/1/2018 11:59:00', periods=3, freq='min')
>>> rng
DatetimeIndex(['2018-01-01 11:59:00', '2018-01-01 12:00:00',
               '2018-01-01 12:01:00'],
              dtype='datetime64[ns]', freq='T')
>>> rng.round('H')
DatetimeIndex(['2018-01-01 12:00:00', '2018-01-01 12:00:00',
               '2018-01-01 12:00:00'],
              dtype='datetime64[ns]', freq=None)
  Series 
>>> pd.Series(rng).dt.round("H")
0   2018-01-01 12:00:00
1   2018-01-01 12:00:00
2   2018-01-01 12:00:00
dtype: datetime64[ns]
  When rounding near a daylight savings time transition, use ambiguous or nonexistent to control how the timestamp should be re-localized. 
>>> rng_tz = pd.DatetimeIndex(["2021-10-31 03:30:00"], tz="Europe/Amsterdam")
  
>>> rng_tz.floor("2H", ambiguous=False)
DatetimeIndex(['2021-10-31 02:00:00+01:00'],
              dtype='datetime64[ns, Europe/Amsterdam]', freq=None)
  
>>> rng_tz.floor("2H", ambiguous=True)
DatetimeIndex(['2021-10-31 02:00:00+02:00'],
              dtype='datetime64[ns, Europe/Amsterdam]', freq=None)
pandas.Series.dt.second   Series.dt.second
 
The seconds of the datetime. Examples 
>>> datetime_series = pd.Series(
...     pd.date_range("2000-01-01", periods=3, freq="s")
... )
>>> datetime_series
0   2000-01-01 00:00:00
1   2000-01-01 00:00:01
2   2000-01-01 00:00:02
dtype: datetime64[ns]
>>> datetime_series.dt.second
0    0
1    1
2    2
dtype: int64
pandas.Series.dt.seconds   Series.dt.seconds
 
Number of seconds (>= 0 and less than 1 day) for each element.
pandas.Series.dt.strftime   Series.dt.strftime(*args, **kwargs)[source]
 
Convert to Index using specified date_format. Return an Index of formatted strings specified by date_format, which supports the same string format as the python standard library. Details of the string format can be found in python string format doc.  Parameters 
 
date_format:str


Date format string (e.g. “%Y-%m-%d”).    Returns 
 ndarray[object]

NumPy ndarray of formatted strings.      See also  to_datetime

Convert the given argument to datetime.  DatetimeIndex.normalize

Return DatetimeIndex with times to midnight.  DatetimeIndex.round

Round the DatetimeIndex to the specified freq.  DatetimeIndex.floor

Floor the DatetimeIndex to the specified freq.    Examples 
>>> rng = pd.date_range(pd.Timestamp("2018-03-10 09:00"),
...                     periods=3, freq='s')
>>> rng.strftime('%B %d, %Y, %r')
Index(['March 10, 2018, 09:00:00 AM', 'March 10, 2018, 09:00:01 AM',
       'March 10, 2018, 09:00:02 AM'],
      dtype='object')
pandas.Series.dt.time   Series.dt.time
 
Returns numpy array of datetime.time objects. The time part of the Timestamps.
pandas.Series.dt.timetz   Series.dt.timetz
 
Returns numpy array of datetime.time objects with timezone information. The time part of the Timestamps.
pandas.Series.dt.to_period   Series.dt.to_period(*args, **kwargs)[source]
 
Cast to PeriodArray/Index at a particular frequency. Converts DatetimeArray/Index to PeriodArray/Index.  Parameters 
 
freq:str or Offset, optional


One of pandas’ offset strings or an Offset object. Will be inferred by default.    Returns 
 PeriodArray/Index
  Raises 
 ValueError

When converting a DatetimeArray/Index with non-regular values, so that a frequency cannot be inferred.      See also  PeriodIndex

Immutable ndarray holding ordinal values.  DatetimeIndex.to_pydatetime

Return DatetimeIndex as object.    Examples 
>>> df = pd.DataFrame({"y": [1, 2, 3]},
...                   index=pd.to_datetime(["2000-03-31 00:00:00",
...                                         "2000-05-31 00:00:00",
...                                         "2000-08-31 00:00:00"]))
>>> df.index.to_period("M")
PeriodIndex(['2000-03', '2000-05', '2000-08'],
            dtype='period[M]')
  Infer the daily frequency 
>>> idx = pd.date_range("2017-01-01", periods=2)
>>> idx.to_period()
PeriodIndex(['2017-01-01', '2017-01-02'],
            dtype='period[D]')
pandas.Series.dt.to_pydatetime   Series.dt.to_pydatetime()[source]
 
Return the data as an array of datetime.datetime objects. Timezone information is retained if present.  Warning Python’s datetime uses microsecond resolution, which is lower than pandas (nanosecond). The values are truncated.   Returns 
 numpy.ndarray

Object dtype array containing native Python datetime objects.      See also  datetime.datetime

Standard library value for a datetime.    Examples 
>>> s = pd.Series(pd.date_range('20180310', periods=2))
>>> s
0   2018-03-10
1   2018-03-11
dtype: datetime64[ns]
  
>>> s.dt.to_pydatetime()
array([datetime.datetime(2018, 3, 10, 0, 0),
       datetime.datetime(2018, 3, 11, 0, 0)], dtype=object)
  pandas’ nanosecond precision is truncated to microseconds. 
>>> s = pd.Series(pd.date_range('20180310', periods=2, freq='ns'))
>>> s
0   2018-03-10 00:00:00.000000000
1   2018-03-10 00:00:00.000000001
dtype: datetime64[ns]
  
>>> s.dt.to_pydatetime()
array([datetime.datetime(2018, 3, 10, 0, 0),
       datetime.datetime(2018, 3, 10, 0, 0)], dtype=object)
pandas.Series.dt.to_pytimedelta   Series.dt.to_pytimedelta()[source]
 
Return an array of native datetime.timedelta objects. Python’s standard datetime library uses a different representation timedelta’s. This method converts a Series of pandas Timedeltas to datetime.timedelta format with the same length as the original Series.  Returns 
 numpy.ndarray

Array of 1D containing data with datetime.timedelta type.      See also  datetime.timedelta

A duration expressing the difference between two date, time, or datetime.    Examples 
>>> s = pd.Series(pd.to_timedelta(np.arange(5), unit="d"))
>>> s
0   0 days
1   1 days
2   2 days
3   3 days
4   4 days
dtype: timedelta64[ns]
  
>>> s.dt.to_pytimedelta()
array([datetime.timedelta(0), datetime.timedelta(days=1),
datetime.timedelta(days=2), datetime.timedelta(days=3),
datetime.timedelta(days=4)], dtype=object)
pandas.Series.dt.total_seconds   Series.dt.total_seconds(*args, **kwargs)[source]
 
Return total duration of each element expressed in seconds. This method is available directly on TimedeltaArray, TimedeltaIndex and on Series containing timedelta values under the .dt namespace.  Returns 
 
seconds:[ndarray, Float64Index, Series]


When the calling object is a TimedeltaArray, the return type is ndarray. When the calling object is a TimedeltaIndex, the return type is a Float64Index. When the calling object is a Series, the return type is Series of type float64 whose index is the same as the original.      See also  datetime.timedelta.total_seconds

Standard library version of this method.  TimedeltaIndex.components

Return a DataFrame with components of each Timedelta.    Examples Series 
>>> s = pd.Series(pd.to_timedelta(np.arange(5), unit='d'))
>>> s
0   0 days
1   1 days
2   2 days
3   3 days
4   4 days
dtype: timedelta64[ns]
  
>>> s.dt.total_seconds()
0         0.0
1     86400.0
2    172800.0
3    259200.0
4    345600.0
dtype: float64
  TimedeltaIndex 
>>> idx = pd.to_timedelta(np.arange(5), unit='d')
>>> idx
TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'],
               dtype='timedelta64[ns]', freq=None)
  
>>> idx.total_seconds()
Float64Index([0.0, 86400.0, 172800.0, 259200.00000000003, 345600.0],
             dtype='float64')
pandas.Series.dt.tz   Series.dt.tz
 
Return the timezone.  Returns 
 datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None

Returns None when the array is tz-naive.