Skip to content

Commit 8701f26

Browse files
Replace ipython directives with code-blocks in whatsnew v0.15.0
1 parent 6f4e7ca commit 8701f26

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

doc/source/whatsnew/v0.15.0.rst

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,18 @@ Construct a scalar
161161
162162
Access fields for a ``Timedelta``
163163

164-
.. ipython:: python
164+
.. code-block:: ipython
165+
166+
In [14]: td = pd.Timedelta('1 hour 3m 15.5us')
167+
168+
In [15]: td.seconds
169+
Out[15]: 3780
170+
171+
In [16]: td.microseconds
172+
Out[16]: 15
165173
166-
td = pd.Timedelta('1 hour 3min 15.5us')
167-
td.seconds
168-
td.microseconds
169-
td.nanoseconds
174+
In [17]: td.nanoseconds
175+
Out[17]: 500
170176
171177
Construct a ``TimedeltaIndex``
172178

@@ -1029,16 +1035,35 @@ Other:
10291035

10301036
If ``Period`` freq is ``D``, ``H``, ``T``, ``S``, ``L``, ``U``, ``N``, ``Timedelta``-like can be added if the result can have same freq. Otherwise, only the same ``offsets`` can be added.
10311037

1032-
.. ipython:: python
1038+
.. code-block:: ipython
10331039
1034-
idx = pd.period_range('2014-07-01 09:00', periods=5, freq='H')
1035-
idx
1036-
idx + pd.offsets.Hour(2)
1037-
idx + pd.Timedelta('120min')
1040+
In [104]: idx = pd.period_range('2014-07-01 09:00', periods=5, freq='H')
10381041
1039-
idx = pd.period_range('2014-07', periods=5, freq='M')
1040-
idx
1041-
idx + pd.offsets.MonthEnd(3)
1042+
In [105]: idx
1043+
Out[105]:
1044+
PeriodIndex(['2014-07-01 09:00', '2014-07-01 10:00', '2014-07-01 11:00',
1045+
'2014-07-01 12:00', '2014-07-01 13:00'],
1046+
dtype='period[H]', freq='H')
1047+
1048+
In [106]: idx + pd.offsets.Hour(2)
1049+
Out[106]:
1050+
PeriodIndex(['2014-07-01 11:00', '2014-07-01 12:00', '2014-07-01 13:00',
1051+
'2014-07-01 14:00', '2014-07-01 15:00'],
1052+
dtype='period[H]', freq='H')
1053+
1054+
In [107]: idx + pd.Timedelta('120m')
1055+
Out[107]:
1056+
PeriodIndex(['2014-07-01 11:00', '2014-07-01 12:00', '2014-07-01 13:00',
1057+
'2014-07-01 14:00', '2014-07-01 15:00'],
1058+
dtype='period[H]', freq='H')
1059+
1060+
In [108]: idx = pd.period_range('2014-07', periods=5, freq='M')
1061+
1062+
In [109]: idx
1063+
Out[109]: PeriodIndex(['2014-07', '2014-08', '2014-09', '2014-10', '2014-11'], dtype='period[M]', freq='M')
1064+
1065+
In [110]: idx + pd.offsets.MonthEnd(3)
1066+
Out[110]: PeriodIndex(['2014-10', '2014-11', '2014-12', '2015-01', '2015-02'], dtype='period[M]', freq='M')
10421067
10431068
- Added experimental compatibility with ``openpyxl`` for versions >= 2.0. The ``DataFrame.to_excel``
10441069
method ``engine`` keyword now recognizes ``openpyxl1`` and ``openpyxl2``

0 commit comments

Comments
 (0)