You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed some warnings in the travis doc build log in the sense of
"WARNING: Could not parse literal_block as "python". highlighting
skipped." This was because some of the `.. code-block:: python`
directives contained code that could not be interpreted as python.
And, additionally, these code blocks were also not highlighted
correctly (the `In [1]` prompt were not recognized by the default
python highlighter). Therefore, I changed those `.. code-block::
python` directives containing IPython prompt to `.. code-block::
ipython`
Author: Joris Van den Bossche <[email protected]>
Closes#12853 from jorisvandenbossche/fix-ipython-highlighting and squashes the following commits:
1e104cc [Joris Van den Bossche] DOC: fix code-block ipython highlighting
Copy file name to clipboardExpand all lines: doc/source/enhancingperf.rst
+6-6
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ Here's the function in pure python:
68
68
69
69
We achieve our result by using ``apply`` (row-wise):
70
70
71
-
.. code-block:: python
71
+
.. code-block:: ipython
72
72
73
73
In [7]: %timeit df.apply(lambda x: integrate_f(x['a'], x['b'], x['N']), axis=1)
74
74
10 loops, best of 3: 174 ms per loop
@@ -125,7 +125,7 @@ is here to distinguish between function versions):
125
125
to be using bleeding edge ipython for paste to play well with cell magics.
126
126
127
127
128
-
.. code-block:: python
128
+
.. code-block:: ipython
129
129
130
130
In [4]: %timeit df.apply(lambda x: integrate_f_plain(x['a'], x['b'], x['N']), axis=1)
131
131
10 loops, best of 3: 85.5 ms per loop
@@ -154,7 +154,7 @@ We get another huge improvement simply by providing type information:
154
154
...: return s * dx
155
155
...:
156
156
157
-
.. code-block:: python
157
+
.. code-block:: ipython
158
158
159
159
In [4]: %timeit df.apply(lambda x: integrate_f_typed(x['a'], x['b'], x['N']), axis=1)
160
160
10 loops, best of 3: 20.3 ms per loop
@@ -234,7 +234,7 @@ the rows, applying our ``integrate_f_typed``, and putting this in the zeros arra
234
234
Loops like this would be *extremely* slow in python, but in Cython looping
235
235
over numpy arrays is *fast*.
236
236
237
-
.. code-block:: python
237
+
.. code-block:: ipython
238
238
239
239
In [4]: %timeit apply_integrate_f(df['a'].values, df['b'].values, df['N'].values)
240
240
1000 loops, best of 3: 1.25 ms per loop
@@ -284,7 +284,7 @@ advanced cython techniques:
284
284
...: return res
285
285
...:
286
286
287
-
.. code-block:: python
287
+
.. code-block:: ipython
288
288
289
289
In [4]: %timeit apply_integrate_f_wrap(df['a'].values, df['b'].values, df['N'].values)
290
290
1000 loops, best of 3: 987 us per loop
@@ -348,7 +348,7 @@ Using ``numba`` to just-in-time compile your code. We simply take the plain pyth
348
348
349
349
Note that we directly pass ``numpy`` arrays to the numba function. ``compute_numba`` is just a wrapper that provides a nicer interface by passing/returning pandas objects.
Copy file name to clipboardExpand all lines: doc/source/options.rst
+1-1
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ Setting Startup Options in python/ipython Environment
130
130
131
131
Using startup scripts for the python/ipython environment to import pandas and set options makes working with pandas more efficient. To do this, create a .py or .ipy script in the startup directory of the desired profile. An example where the startup folder is in a default ipython profile can be found at:
0 commit comments