Skip to content

Commit ecba524

Browse files
DOC: Use a standard header for all rst files
1 parent 022f458 commit ecba524

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+101
-334
lines changed

doc/source/10min.rst

+1-19
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
11
.. _10min:
22

3-
.. currentmodule:: pandas
4-
5-
.. ipython:: python
6-
:suppress:
7-
8-
import os
9-
import numpy as np
10-
11-
import pandas as pd
12-
13-
np.random.seed(123456)
14-
np.set_printoptions(precision=4, suppress=True)
15-
pd.options.display.max_rows = 15
16-
17-
# portions of this were borrowed from the
18-
# Pandas cheatsheet
19-
# created during the PyData Workshop-Sprint 2012
20-
# Hannah Chen, Henry Chow, Eric Cox, Robert Mauriello
21-
3+
{{ header }}
224

235
********************
246
10 Minutes to pandas

doc/source/advanced.rst

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
.. _advanced:
22

3-
.. currentmodule:: pandas
4-
5-
.. ipython:: python
6-
:suppress:
7-
8-
import numpy as np
9-
import pandas as pd
10-
np.random.seed(123456)
11-
np.set_printoptions(precision=4, suppress=True)
12-
pd.options.display.max_rows = 15
3+
{{ header }}
134

145
******************************
156
MultiIndex / Advanced Indexing

doc/source/basics.rst

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
.. currentmodule:: pandas
2-
3-
.. ipython:: python
4-
:suppress:
5-
6-
import numpy as np
7-
import pandas as pd
8-
9-
np.set_printoptions(precision=4, suppress=True)
10-
pd.options.display.max_rows = 15
11-
121
.. _basics:
132

3+
{{ header }}
4+
145
==============================
156
Essential Basic Functionality
167
==============================

doc/source/categorical.rst

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
.. _categorical:
22

3-
.. currentmodule:: pandas
4-
5-
.. ipython:: python
6-
:suppress:
7-
8-
import numpy as np
9-
import pandas as pd
10-
np.random.seed(123456)
11-
np.set_printoptions(precision=4, suppress=True)
12-
pd.options.display.max_rows = 15
13-
3+
{{ header }}
144

155
****************
166
Categorical Data

doc/source/comparison_with_r.rst

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
.. currentmodule:: pandas
21
.. _compare_with_r:
32

4-
.. ipython:: python
5-
:suppress:
6-
7-
import pandas as pd
8-
import numpy as np
9-
pd.options.display.max_rows = 15
3+
{{ header }}
104

115
Comparison with R / R libraries
126
*******************************

doc/source/computation.rst

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
1-
.. currentmodule:: pandas
2-
3-
.. ipython:: python
4-
:suppress:
5-
6-
import numpy as np
7-
import matplotlib.pyplot as plt
8-
9-
import pandas as pd
10-
11-
np.random.seed(123456)
12-
np.set_printoptions(precision=4, suppress=True)
13-
pd.options.display.max_rows = 15
14-
15-
plt.close('all')
16-
171
.. _computation:
182

3+
{{ header }}
4+
195
Computational tools
206
===================
217

doc/source/conf.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -301,25 +301,38 @@
301301
}
302302

303303

304-
common_imports = """\
304+
header = """\
305305
.. currentmodule:: pandas
306306
307307
.. ipython:: python
308308
:suppress:
309309
310+
import csv
311+
from datetime import datetime, timedelta
312+
import functools
313+
import glob
314+
import itertools
315+
import os
316+
310317
import numpy as np
311318
from pandas import *
312319
import pandas as pd
320+
from pandas.compat import StringIO, BytesIO
321+
import matplotlib
322+
import matplotlib.pyplot as plt
323+
324+
313325
randn = np.random.randn
326+
np.random.seed(123456)
314327
np.set_printoptions(precision=4, suppress=True)
315-
options.display.max_rows = 15
316-
from pandas.compat import StringIO
328+
pd.options.display.max_rows = 15
329+
plt.close('all')
317330
"""
318331

319332

320333
html_context = {
321334
'redirects': {old: new for old, new in moved_api_pages},
322-
'common_imports': common_imports,
335+
'header': header
323336
}
324337

325338
# If false, no module index is generated.

doc/source/contributing.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ Otherwise, you need to do it manually:
672672
673673
import warnings
674674
675+
675676
def old_func():
676677
"""Summary of the function.
677678
@@ -681,6 +682,7 @@ Otherwise, you need to do it manually:
681682
warnings.warn('Use new_func instead.', FutureWarning, stacklevel=2)
682683
new_func()
683684
685+
684686
def new_func():
685687
pass
686688
@@ -938,8 +940,10 @@ If your change involves checking that a warning is actually emitted, use
938940

939941
.. code-block:: python
940942
941-
df = pd.DataFrame()
943+
import pandas.util.testing as tm
942944
945+
946+
df = pd.DataFrame()
943947
with tm.assert_produces_warning(FutureWarning):
944948
df.some_operation()
945949

doc/source/cookbook.rst

+6-25
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
.. _cookbook:
22

3-
.. currentmodule:: pandas
4-
5-
.. ipython:: python
6-
:suppress:
7-
8-
import datetime
9-
import functools
10-
import glob
11-
import itertools
12-
import os
13-
14-
import numpy as np
15-
import pandas as pd
16-
from pandas.compat import StringIO
17-
18-
19-
np.random.seed(123456)
20-
np.set_printoptions(precision=4, suppress=True)
21-
pd.options.display.max_rows = 15
22-
3+
{{ header }}
234

245
********
256
Cookbook
@@ -1333,20 +1314,20 @@ The :ref:`Timedeltas <timedeltas.timedeltas>` docs.
13331314
13341315
s.max() - s
13351316
1336-
s - datetime.datetime(2011, 1, 1, 3, 5)
1317+
s - datetime(2011, 1, 1, 3, 5)
13371318
1338-
s + datetime.timedelta(minutes=5)
1319+
s + timedelta(minutes=5)
13391320
1340-
datetime.datetime(2011, 1, 1, 3, 5) - s
1321+
datetime(2011, 1, 1, 3, 5) - s
13411322
1342-
datetime.timedelta(minutes=5) + s
1323+
timedelta(minutes=5) + s
13431324
13441325
`Adding and subtracting deltas and dates
13451326
<http://stackoverflow.com/questions/16385785/add-days-to-dates-in-dataframe>`__
13461327

13471328
.. ipython:: python
13481329
1349-
deltas = pd.Series([datetime.timedelta(days=i) for i in range(3)])
1330+
deltas = pd.Series([timedelta(days=i) for i in range(3)])
13501331
13511332
df = pd.DataFrame({'A': s, 'B': deltas})
13521333
df

doc/source/dsintro.rst

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
1-
.. currentmodule:: pandas
2-
3-
.. ipython:: python
4-
:suppress:
5-
6-
import numpy as np
7-
np.set_printoptions(precision=4, suppress=True)
8-
import pandas as pd
9-
pd.set_option('display.precision', 4, 'display.max_columns', 8)
10-
pd.options.display.max_rows = 15
11-
12-
import matplotlib
13-
# matplotlib.style.use('default')
14-
import matplotlib.pyplot as plt
15-
plt.close('all')
16-
171
.. _dsintro:
182

3+
{{ header }}
4+
195
************************
206
Intro to Data Structures
217
************************

doc/source/enhancingperf.rst

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
.. _enhancingperf:
22

3-
.. currentmodule:: pandas
4-
5-
.. ipython:: python
6-
:suppress:
7-
8-
import numpy as np
9-
np.random.seed(123456)
10-
np.set_printoptions(precision=4, suppress=True)
11-
import pandas as pd
12-
pd.options.display.max_rows=15
13-
14-
import os
15-
import csv
16-
3+
{{ header }}
174

185
*********************
196
Enhancing Performance

doc/source/gotchas.rst

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
.. currentmodule:: pandas
21
.. _gotchas:
32

3+
{{ header }}
4+
45
********************************
56
Frequently Asked Questions (FAQ)
67
********************************
78

8-
.. ipython:: python
9-
:suppress:
10-
11-
import numpy as np
12-
import pandas as pd
13-
14-
np.random.seed(123456)
15-
np.set_printoptions(precision=4, suppress=True)
16-
pd.options.display.max_rows = 15
17-
189
.. _df-memory-usage:
1910

2011
DataFrame memory usage

doc/source/groupby.rst

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
.. currentmodule:: pandas
21
.. _groupby:
32

4-
.. ipython:: python
5-
:suppress:
6-
7-
import numpy as np
8-
import matplotlib.pyplot as plt
9-
10-
import pandas as pd
11-
12-
plt.close('all')
13-
14-
np.random.seed(123456)
15-
np.set_printoptions(precision=4, suppress=True)
16-
pd.options.display.max_rows = 15
3+
{{ header }}
174

185
*****************************
196
Group By: split-apply-combine

doc/source/indexing.rst

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
.. _indexing:
22

3-
.. currentmodule:: pandas
4-
5-
.. ipython:: python
6-
:suppress:
7-
8-
import numpy as np
9-
np.random.seed(123456)
10-
np.set_printoptions(precision=4, suppress=True)
11-
import pandas as pd
12-
pd.options.display.max_rows=15
3+
{{ header }}
134

145
***************************
156
Indexing and Selecting Data

doc/source/internals.rst

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
.. _internals:
22

3-
.. currentmodule:: pandas
4-
5-
.. ipython:: python
6-
:suppress:
7-
8-
import numpy as np
9-
import pandas as pd
10-
11-
np.random.seed(123456)
12-
np.set_printoptions(precision=4, suppress=True)
13-
pd.options.display.max_rows = 15
3+
{{ header }}
144

155
*********
166
Internals

doc/source/io.rst

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
.. _io:
22

3-
.. currentmodule:: pandas
3+
{{ header }}
44

55
.. ipython:: python
66
:suppress:
77
8-
import csv
9-
import os
10-
11-
import matplotlib.pyplot as plt
12-
import numpy as np
13-
import pandas as pd
14-
from pandas.compat import StringIO, BytesIO
15-
16-
17-
randn = np.random.randn
18-
np.set_printoptions(precision=4, suppress=True)
19-
plt.close('all')
20-
pd.options.display.max_rows = 15
218
clipdf = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': ['p', 'q', 'r']},
229
index=['x', 'y', 'z'])
2310

0 commit comments

Comments
 (0)