@@ -915,46 +915,6 @@ def to_series(self, keep_tz=False):
915
915
index = self ._shallow_copy (),
916
916
name = self .name )
917
917
918
- def to_frame (self , index = True , keep_tz = False ):
919
- """
920
- Create a DataFrame with a column containing the DatetimeIndex.
921
-
922
- .. versionadded:: 0.21.0
923
-
924
- Parameters
925
- ----------
926
- index : boolean, default True
927
- Set the index of the returned DataFrame
928
- as the original DatetimeIndex.
929
-
930
- keep_tz : optional, defaults False.
931
- return the data keeping the timezone.
932
-
933
- If keep_tz is True:
934
-
935
- If the timezone is not set, the resulting
936
- Series will have a datetime64[ns] dtype.
937
-
938
- Otherwise the DataFrame will have an datetime64[ns, tz] dtype;
939
- the tz will be preserved.
940
-
941
- If keep_tz is False:
942
-
943
- DataFrame will have a datetime64[ns] dtype. TZ aware
944
- objects will have the tz removed.
945
-
946
- Returns
947
- -------
948
- DataFrame : a DataFrame containing the original DatetimeIndex data.
949
- """
950
-
951
- from pandas import DataFrame
952
- result = DataFrame (self ._to_embed (keep_tz ), columns = [self .name or 0 ])
953
-
954
- if index :
955
- result .index = self
956
- return result
957
-
958
918
def _to_embed (self , keep_tz = False ):
959
919
"""
960
920
return an array repr of this object, potentially casting to object
0 commit comments