|
2 | 2 |
|
3 | 3 | .. currentmodule:: pandas
|
4 | 4 |
|
5 |
| -.. ipython:: python |
6 |
| - :suppress: |
7 |
| -
|
8 |
| - import pandas as pd |
9 |
| - pd.options.display.max_rows = 15 |
10 |
| - clipdf = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': ['p', 'q', 'r']}, |
11 |
| - index=['x', 'y', 'z']) |
12 |
| -
|
13 | 5 |
|
14 | 6 | ===============================
|
15 | 7 | IO tools (text, CSV, HDF5, ...)
|
@@ -136,7 +128,9 @@ usecols : list-like or callable, default ``None``
|
136 | 128 |
|
137 | 129 | .. ipython:: python
|
138 | 130 |
|
139 |
| - from io import StringIO, BytesIO |
| 131 | + import pandas as pd |
| 132 | + pd.options.display.max_rows = 15 |
| 133 | + from io import StringIO |
140 | 134 | data = ('col1,col2,col3\n'
|
141 | 135 | 'a,b,1\n'
|
142 | 136 | 'a,b,2\n'
|
@@ -757,6 +751,7 @@ result in byte strings being decoded to unicode in the result:
|
757 | 751 |
|
758 | 752 | .. ipython:: python
|
759 | 753 |
|
| 754 | + from io import BytesIO |
760 | 755 | data = (b'word,length\n'
|
761 | 756 | b'Tr\xc3\xa4umen,7\n'
|
762 | 757 | b'Gr\xc3\xbc\xc3\x9fe,5')
|
@@ -3267,6 +3262,12 @@ clipboard (CTRL-C on many operating systems):
|
3267 | 3262 |
|
3268 | 3263 | And then import the data directly to a ``DataFrame`` by calling:
|
3269 | 3264 |
|
| 3265 | +.. ipython:: python |
| 3266 | + :suppress: |
| 3267 | +
|
| 3268 | + clipdf = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': ['p', 'q', 'r']}, |
| 3269 | + index=['x', 'y', 'z']) |
| 3270 | +
|
3270 | 3271 | .. code-block:: python
|
3271 | 3272 |
|
3272 | 3273 | >>> clipdf = pd.read_clipboard()
|
@@ -5563,6 +5564,8 @@ Given the next test set:
|
5563 | 5564 |
|
5564 | 5565 | .. code-block:: python
|
5565 | 5566 |
|
| 5567 | + import os |
| 5568 | +
|
5566 | 5569 | sz = 1000000
|
5567 | 5570 | df = pd.DataFrame({'A': np.random.randn(sz), 'B': [1] * sz})
|
5568 | 5571 |
|
|
0 commit comments