File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,37 @@ scalar values and ``PeriodIndex`` for sequences of spans. Better support for
110
110
irregular intervals with arbitrary start and end points are forth-coming in
111
111
future releases.
112
112
113
+
114
+ .. _timeseries.converting :
115
+
116
+ Converting to Timestamps
117
+ ------------------------
118
+
119
+ To convert a list or Series of datetimes or strings (or a mixture, or NAs),
120
+ you can use the ``to_datetime `` function:
121
+
122
+ .. ipython :: python
123
+
124
+ pd.to_datetime([' Jul 31, 2009' , ' 2010-01-10' ])
125
+
126
+ pd.to_datetime([' 2005/11/23' , ' 2010.12.31' ' ])
127
+
128
+ If you use dates start with the dayfirst (European style), you can pass
129
+ the dayfirst flag:
130
+
131
+ .. ipython:: python
132
+
133
+ to_datetime([' 12-13-2012' ], dayfirst = True )
134
+
135
+ * There is a known bug that this falls back to not dayfirst if there are
136
+ inconsistent date formats.*
137
+
138
+ Pass `` coerce=True `` to convert data to `` NaT`` (not a time):
139
+
140
+ .. ipython:: python
141
+
142
+ pd.to_datetime([' 2009-07-31' , ' asd' ], coerce = True )
143
+
113
144
.. _timeseries.daterange:
114
145
115
146
Generating Ranges of Timestamps
You can’t perform that action at this time.
0 commit comments