Skip to content

Commit 5e0fbe3

Browse files
committed
DOC: Make explicit in pandas IO doc the iports and options
- Removes code header in IO doc page. - Uses explicit imports in the IO page of user guide on first occurence of requirement. - In reference to #28038
1 parent 32b4710 commit 5e0fbe3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

doc/source/user_guide/io.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
.. currentmodule:: pandas
44

5-
6-
{{ header }}
7-
85
.. ipython:: python
96
:suppress:
107
8+
import pandas as pd
9+
pd.options.display.max_rows = 15
1110
clipdf = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': ['p', 'q', 'r']},
1211
index=['x', 'y', 'z'])
1312
@@ -363,6 +362,8 @@ columns:
363362

364363
.. ipython:: python
365364
365+
import numpy as np
366+
np.set_printoptions(precision=4, suppress=True)
366367
data = ('a,b,c,d\n'
367368
'1,2,3,4\n'
368369
'5,6,7,8\n'
@@ -447,7 +448,6 @@ worth trying.
447448
:suppress:
448449
449450
import os
450-
451451
os.remove('foo.csv')
452452
453453
.. _io.categorical:
@@ -1579,6 +1579,7 @@ class of the csv module. For this, you have to specify ``sep=None``.
15791579
.. ipython:: python
15801580
:suppress:
15811581
1582+
np.random.seed(123456)
15821583
df = pd.DataFrame(np.random.randn(10, 4))
15831584
df.to_csv('tmp.sv', sep='|')
15841585
df.to_csv('tmp2.sv', sep=':')
@@ -5562,10 +5563,8 @@ Given the next test set:
55625563

55635564
.. code-block:: python
55645565
5565-
from numpy.random import randn
5566-
55675566
sz = 1000000
5568-
df = pd.DataFrame({'A': randn(sz), 'B': [1] * sz})
5567+
df = pd.DataFrame({'A': np.random.randn(sz), 'B': [1] * sz})
55695568
55705569
55715570
def test_sql_write(df):

0 commit comments

Comments
 (0)