@@ -663,14 +663,14 @@ def _get_time_micros(self):
663663 values = self ._data ._local_timestamps ()
664664 return fields .get_time_micros (values )
665665
666- def to_series (self , keep_tz = None , index = None , name = None ):
666+ def to_series (self , keep_tz = lib . _no_default , index = None , name = None ):
667667 """
668668 Create a Series with both index and values equal to the index keys
669669 useful with map for returning an indexer based on an index.
670670
671671 Parameters
672672 ----------
673- keep_tz : optional, defaults False
673+ keep_tz : optional, defaults True
674674 Return the data keeping the timezone.
675675
676676 If keep_tz is True:
@@ -686,10 +686,10 @@ def to_series(self, keep_tz=None, index=None, name=None):
686686 Series will have a datetime64[ns] dtype. TZ aware
687687 objects will have the tz removed.
688688
689- .. versionchanged:: 0.24
690- The default value will change to True in a future release.
691- You can set ``keep_tz=True`` to already obtain the future
692- behaviour and silence the warning.
689+ .. versionchanged:: 1.0.0
690+ The default value is now True. In a future version,
691+ this keyword will be removed entirely. Stop passing the
692+ argument to obtain the future behavior and silence the warning.
693693
694694 index : Index, optional
695695 Index of resulting Series. If None, defaults to original index.
@@ -708,27 +708,27 @@ def to_series(self, keep_tz=None, index=None, name=None):
708708 if name is None :
709709 name = self .name
710710
711- if keep_tz is None and self . tz is not None :
712- warnings . warn (
713- "The default of the 'keep_tz' keyword in "
714- " DatetimeIndex.to_series will change "
715- "to True in a future release. You can set "
716- " 'keep_tz=True ' to obtain the future behaviour and "
717- "silence this warning." ,
718- FutureWarning ,
719- stacklevel = 2 ,
720- )
721- keep_tz = False
722- elif keep_tz is False :
723- warnings . warn (
724- "Specifying 'keep_tz=False' is deprecated and this "
725- "option will be removed in a future release. If "
726- "you want to remove the timezone information, you "
727- "can do 'idx.tz_convert(None)' before calling "
728- "'to_series'." ,
729- FutureWarning ,
730- stacklevel = 2 ,
731- )
711+ if keep_tz is not lib . _no_default :
712+ if keep_tz :
713+ warnings . warn (
714+ "The 'keep_tz' keyword in DatetimeIndex.to_series "
715+ "is deprecated and will be removed in a future version. "
716+ "You can stop passing 'keep_tz' to silence this warning." ,
717+ FutureWarning ,
718+ stacklevel = 2 ,
719+ )
720+ else :
721+ warnings . warn (
722+ "Specifying ' keep_tz=False' is deprecated and this "
723+ "option will be removed in a future release. If "
724+ "you want to remove the timezone information, you "
725+ "can do 'idx.tz_convert(None)' before calling "
726+ "'to_series'." ,
727+ FutureWarning ,
728+ stacklevel = 2 ,
729+ )
730+ else :
731+ keep_tz = True
732732
733733 if keep_tz and self .tz is not None :
734734 # preserve the tz & copy
0 commit comments