Skip to content

Commit 4de033d

Browse files
committed
Merge pull request #7455 from shoyer/month-start-cookbook
DOC: Add how to calculate month-start to cookbook
2 parents c83ee14 + d621299 commit 4de033d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/source/cookbook.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ Turn a matrix with hours in columns and days in rows into a continuous row seque
269269
`Dealing with duplicates when reindexing a timeseries to a specified frequency
270270
<http://stackoverflow.com/questions/22244383/pandas-df-refill-adding-two-columns-of-different-shape>`__
271271

272+
Calculate the first day of the month for each entry in a DatetimeIndex
273+
274+
.. ipython:: python
275+
276+
dates = pd.date_range('2000-01-01', periods=5)
277+
dates.to_period(freq='M').to_timestamp()
278+
272279
.. _cookbook.resample:
273280

274281
Resampling

0 commit comments

Comments
 (0)