@@ -2562,6 +2562,50 @@ def rename(self, mapper, inplace=False):
2562
2562
def weekday (self ):
2563
2563
return Series ([d .weekday () for d in self .index ], index = self .index )
2564
2564
2565
+ def tz_convert (self , tz , copy = True ):
2566
+ """
2567
+ Convert TimeSeries to target time zone
2568
+
2569
+ Parameters
2570
+ ----------
2571
+ tz : string or pytz.timezone object
2572
+ copy : boolean, default True
2573
+ Also make a copy of the underlying data
2574
+
2575
+ Returns
2576
+ -------
2577
+ converted : TimeSeries
2578
+ """
2579
+ new_index = self .index .tz_convert (tz )
2580
+
2581
+ new_values = self .values
2582
+ if copy :
2583
+ new_values = new_values .copy ()
2584
+
2585
+ return Series (new_values , index = new_index , name = self .name )
2586
+
2587
+ def tz_localize (self , tz , copy = True ):
2588
+ """
2589
+ Localize tz-naive TimeSeries to target time zone
2590
+
2591
+ Parameters
2592
+ ----------
2593
+ tz : string or pytz.timezone object
2594
+ copy : boolean, default True
2595
+ Also make a copy of the underlying data
2596
+
2597
+ Returns
2598
+ -------
2599
+ localized : TimeSeries
2600
+ """
2601
+ new_index = self .index .tz_localize (tz )
2602
+
2603
+ new_values = self .values
2604
+ if copy :
2605
+ new_values = new_values .copy ()
2606
+
2607
+ return Series (new_values , index = new_index , name = self .name )
2608
+
2565
2609
2566
2610
_INDEX_TYPES = ndarray , Index , list , tuple
2567
2611
@@ -2766,50 +2810,6 @@ def between_time(self, start_time, end_time, include_start=True,
2766
2810
include_start = include_start ,
2767
2811
include_end = include_end )
2768
2812
2769
- def tz_convert (self , tz , copy = True ):
2770
- """
2771
- Convert TimeSeries to target time zone
2772
-
2773
- Parameters
2774
- ----------
2775
- tz : string or pytz.timezone object
2776
- copy : boolean, default True
2777
- Also make a copy of the underlying data
2778
-
2779
- Returns
2780
- -------
2781
- converted : TimeSeries
2782
- """
2783
- new_index = self .index .tz_convert (tz )
2784
-
2785
- new_values = self .values
2786
- if copy :
2787
- new_values = new_values .copy ()
2788
-
2789
- return Series (new_values , index = new_index , name = self .name )
2790
-
2791
- def tz_localize (self , tz , copy = True ):
2792
- """
2793
- Localize tz-naive TimeSeries to target time zone
2794
-
2795
- Parameters
2796
- ----------
2797
- tz : string or pytz.timezone object
2798
- copy : boolean, default True
2799
- Also make a copy of the underlying data
2800
-
2801
- Returns
2802
- -------
2803
- localized : TimeSeries
2804
- """
2805
- new_index = self .index .tz_localize (tz )
2806
-
2807
- new_values = self .values
2808
- if copy :
2809
- new_values = new_values .copy ()
2810
-
2811
- return Series (new_values , index = new_index , name = self .name )
2812
-
2813
2813
def to_timestamp (self , freq = None , how = 'start' , copy = True ):
2814
2814
"""
2815
2815
Cast to datetimeindex of timestamps, at *beginning* of period
0 commit comments