Skip to content

Commit e3911df

Browse files
adamkleinwesm
authored andcommitted
ENH: docs build cleanly, per #635
1 parent 98395ac commit e3911df

File tree

8 files changed

+24
-32
lines changed

8 files changed

+24
-32
lines changed

doc/source/dsintro.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ objects. To get started, import numpy and load pandas into your namespace:
1616
import numpy as np
1717
from pandas import *
1818
randn = np.random.randn
19-
np.set_printoptions(precision=4, suppress=True, max_columns=8)
19+
np.set_printoptions(precision=4, suppress=True)
20+
set_printoptions(precision=4, max_columns=8)
2021
2122
.. ipython:: python
2223

doc/source/io.rst

-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ performance HDF5 format using the excellent `PyTables
349349
350350
.. ipython:: python
351351
352-
fo
353352
store = HDFStore('store.h5')
354353
print store
355354

doc/source/merging.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ along ``axis=0``, namely the index:
152152
.. ipython:: python
153153
154154
s = Series(randn(10), index=np.arange(10))
155-
s1 = s[:5]
156-
s2 = s[-5:]
155+
s1 = s[:5] # note we're slicing with labels here, so 5 is included
156+
s2 = s[6:]
157157
s1.append(s2)
158158
159159
In the case of DataFrame, the indexes must be disjoint but the columns do not

doc/source/missing_data.rst

+1
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ an ndarray (e.g. selecting values based on some criteria). If a boolean vector
256256
contains NAs, an exception will be generated:
257257

258258
.. ipython:: python
259+
:okexcept:
259260
260261
reindexed = s.reindex(range(8)).fillna(0)
261262
reindexed[crit]

doc/source/visualization.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ groupings. For instance,
170170
df = DataFrame(np.random.rand(10,2), columns=['Col1', 'Col2'] )
171171
df['X'] = Series(['A','A','A','A','A','B','B','B','B','B'])
172172
173-
plot.figure();
173+
plt.figure();
174174
175175
@savefig box_plot_ex2.png width=4.5in
176176
df.boxplot(by='X')
@@ -184,7 +184,7 @@ columns:
184184
df['X'] = Series(['A','A','A','A','A','B','B','B','B','B'])
185185
df['Y'] = Series(['A','B','A','B','A','B','A','B','A','B'])
186186
187-
plot.figure();
187+
plt.figure();
188188
189189
@savefig box_plot_ex3.png width=4.5in
190190
df.boxplot(column=['Col1','Col2'], by=['X','Y'])

doc/sphinxext/ipython_directive.py

+3-15
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,6 @@ def __init__(self):
215215
# Create and initialize ipython, but don't start its mainloop
216216
IP = InteractiveShell.instance(config=config, profile_dir=profile)
217217

218-
self_closure = self
219-
220-
def custom_handler(self, etype, value, tb, tb_offset=None):
221-
if not self_closure.suppress_exception_warning:
222-
errstr = ("WARNING: Exception in statement '%s', %s, %s)\n"
223-
% (self_closure.datacontent[1], etype, value))
224-
sys.stderr.write(errstr)
225-
226-
IP.set_custom_exc((Exception,), custom_handler)
227-
228218
# io.stdout redirect must be done *after* instantiating InteractiveShell
229219
io.stdout = self.cout
230220
io.stderr = self.cout
@@ -315,11 +305,6 @@ def process_input(self, data, input_prompt, lineno):
315305

316306
input_lines = input.split('\n')
317307

318-
if is_okexcept:
319-
self.suppress_exception_warning = True
320-
else:
321-
self.suppress_exception_warning = False
322-
323308
self.datacontent = data
324309

325310
continuation = ' %s:'%''.join(['.']*(len(str(lineno))+2))
@@ -369,6 +354,9 @@ def process_input(self, data, input_prompt, lineno):
369354
if not is_suppress and not is_semicolon:
370355
ret.append(output)
371356

357+
if not is_okexcept and "Traceback" in output:
358+
sys.stdout.write(output)
359+
372360
self.cout.truncate(0)
373361
return (ret, input_lines, output, is_doctest, image_file,
374362
image_directive)

pandas/core/daterange.py

+3
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ def __getitem__(self, key):
221221
new_index.name = self.name
222222
return new_index
223223
else:
224+
if result.ndim > 1:
225+
return result
226+
224227
return Index(result, name=self.name)
225228

226229
def summary(self):

pandas/core/frame.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -3555,17 +3555,17 @@ def plot(self, subplots=False, sharex=True, sharey=False, use_index=True,
35553555
empty = self[col].count() == 0
35563556
y = self[col].values if not empty else np.zeros(x.shape)
35573557

3558-
try:
3559-
if subplots:
3560-
ax = axes[i]
3561-
ax.plot(x, y, 'k', label=str(col), **kwds)
3562-
ax.legend(loc='best')
3563-
else:
3564-
ax.plot(x, y, label=str(col), **kwds)
3565-
except Exception, e:
3566-
msg = ('Unable to plot data %s vs index %s,\n'
3567-
'error was: %s' % (str(y), str(x), str(e)))
3568-
raise Exception(msg)
3558+
#try:
3559+
if subplots:
3560+
ax = axes[i]
3561+
ax.plot(x, y, 'k', label=str(col), **kwds)
3562+
ax.legend(loc='best')
3563+
else:
3564+
ax.plot(x, y, label=str(col), **kwds)
3565+
#except Exception, e:
3566+
# msg = ('Unable to plot data %s vs index %s,\n'
3567+
# 'error was: %s' % (str(y), str(x), str(e)))
3568+
# raise Exception(msg)
35693569

35703570
ax.grid(grid)
35713571

0 commit comments

Comments
 (0)