Skip to content

Commit f552b2f

Browse files
committed
Merge commit 'v0.7.0rc1-2-g91cfcb4' into debian
* commit 'v0.7.0rc1-2-g91cfcb4': BUG: Fix out-of-bounds segfault in pad_object and backfill_object methods BLD: exclude png files from tarball RLS: 0.7.0 Release Candidate 1 ENH: don't try to autofmt_xdate if sharex=False in DataFrame.plot TST: python 2.5/6 issues with Decimal
2 parents 26cb200 + 91cfcb4 commit f552b2f

File tree

12 files changed

+97
-19
lines changed

12 files changed

+97
-19
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ global-exclude *.pyd
1717
global-exclude *.pyc
1818
global-exclude .git*
1919
global-exclude .DS_Store
20+
global-exclude *.png
2021

2122
# include examples/data/*
2223
# recursive-include examples *.py

RELEASE.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ pandas 0.7.0
217217
- Catch misreported console size when running IPython within Emacs
218218
- Fix minor bug in pivot table margins, loss of index names and length-1
219219
'All' tuple in row labels
220-
- Add support for legacy
220+
- Add support for legacy WidePanel objects to be read from HDFStore
221+
- Fix out-of-bounds segfault in pad_object and backfill_object methods when
222+
either source or target array are empty
221223

222224
Thanks
223225
------

pandas/core/frame.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3628,11 +3628,11 @@ def plot(self, subplots=False, sharex=True, sharey=False, use_index=True,
36283628
self._bar_plot(axes, subplots=subplots, grid=grid, rot=rot,
36293629
legend=legend)
36303630

3631-
# try to make things prettier
3632-
try:
3633-
fig.autofmt_xdate()
3634-
except Exception: # pragma: no cover
3635-
pass
3631+
if not subplots or (subplots and sharex):
3632+
try:
3633+
fig.autofmt_xdate()
3634+
except Exception: # pragma: no cover
3635+
pass
36363636

36373637
plt.draw_if_interactive()
36383638
if subplots:

pandas/core/series.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,7 @@ def plot(self, label=None, kind='line', use_index=True, rot=30, ax=None,
17811781
Intended to be used in ipython --pylab mode
17821782
"""
17831783
import matplotlib.pyplot as plt
1784+
import pandas.tools.plotting as gfx
17841785

17851786
if label is not None:
17861787
kwds = kwds.copy()
@@ -1801,6 +1802,7 @@ def plot(self, label=None, kind='line', use_index=True, rot=30, ax=None,
18011802
ax.semilogy(x, self.values.astype(float), style, **kwds)
18021803
else:
18031804
ax.plot(x, self.values.astype(float), style, **kwds)
1805+
gfx.format_date_labels(ax)
18041806
elif kind == 'bar':
18051807
xinds = np.arange(N) + 0.25
18061808
ax.bar(xinds, self.values.astype(float), 0.5,
@@ -1815,14 +1817,6 @@ def plot(self, label=None, kind='line', use_index=True, rot=30, ax=None,
18151817
ax.set_xticklabels(self.index, rotation=rot, fontsize=fontsize)
18161818

18171819
ax.grid(grid)
1818-
1819-
# try to make things prettier
1820-
try:
1821-
fig = plt.gcf()
1822-
fig.autofmt_xdate()
1823-
except Exception: # pragma: no cover
1824-
pass
1825-
18261820
plt.draw_if_interactive()
18271821

18281822
return ax

pandas/src/generate_code.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ def backfill_%(name)s(ndarray[%(c_type)s] oldIndex,
147147
fill_vec = np.empty(len(newIndex), dtype = np.int32)
148148
fill_vec.fill(-1)
149149
150+
if oldLength == 0 or newLength == 0:
151+
return fill_vec
152+
150153
oldPos = oldLength - 1
151154
newPos = newLength - 1
152155
@@ -221,6 +224,9 @@ def pad_%(name)s(ndarray[%(c_type)s] oldIndex,
221224
fill_vec = np.empty(len(newIndex), dtype = np.int32)
222225
fill_vec.fill(-1)
223226
227+
if oldLength == 0 or newLength == 0:
228+
return fill_vec
229+
224230
oldPos = 0
225231
newPos = 0
226232

pandas/src/generated.pyx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ def pad_float64(ndarray[float64_t] oldIndex,
216216
fill_vec = np.empty(len(newIndex), dtype = np.int32)
217217
fill_vec.fill(-1)
218218

219+
if oldLength == 0 or newLength == 0:
220+
return fill_vec
221+
219222
oldPos = 0
220223
newPos = 0
221224

@@ -271,6 +274,9 @@ def pad_object(ndarray[object] oldIndex,
271274
fill_vec = np.empty(len(newIndex), dtype = np.int32)
272275
fill_vec.fill(-1)
273276

277+
if oldLength == 0 or newLength == 0:
278+
return fill_vec
279+
274280
oldPos = 0
275281
newPos = 0
276282

@@ -326,6 +332,9 @@ def pad_int32(ndarray[int32_t] oldIndex,
326332
fill_vec = np.empty(len(newIndex), dtype = np.int32)
327333
fill_vec.fill(-1)
328334

335+
if oldLength == 0 or newLength == 0:
336+
return fill_vec
337+
329338
oldPos = 0
330339
newPos = 0
331340

@@ -381,6 +390,9 @@ def pad_int64(ndarray[int64_t] oldIndex,
381390
fill_vec = np.empty(len(newIndex), dtype = np.int32)
382391
fill_vec.fill(-1)
383392

393+
if oldLength == 0 or newLength == 0:
394+
return fill_vec
395+
384396
oldPos = 0
385397
newPos = 0
386398

@@ -436,6 +448,9 @@ def pad_bool(ndarray[uint8_t] oldIndex,
436448
fill_vec = np.empty(len(newIndex), dtype = np.int32)
437449
fill_vec.fill(-1)
438450

451+
if oldLength == 0 or newLength == 0:
452+
return fill_vec
453+
439454
oldPos = 0
440455
newPos = 0
441456

@@ -492,6 +507,9 @@ def backfill_float64(ndarray[float64_t] oldIndex,
492507
fill_vec = np.empty(len(newIndex), dtype = np.int32)
493508
fill_vec.fill(-1)
494509

510+
if oldLength == 0 or newLength == 0:
511+
return fill_vec
512+
495513
oldPos = oldLength - 1
496514
newPos = newLength - 1
497515

@@ -541,6 +559,9 @@ def backfill_object(ndarray[object] oldIndex,
541559
fill_vec = np.empty(len(newIndex), dtype = np.int32)
542560
fill_vec.fill(-1)
543561

562+
if oldLength == 0 or newLength == 0:
563+
return fill_vec
564+
544565
oldPos = oldLength - 1
545566
newPos = newLength - 1
546567

@@ -590,6 +611,9 @@ def backfill_int32(ndarray[int32_t] oldIndex,
590611
fill_vec = np.empty(len(newIndex), dtype = np.int32)
591612
fill_vec.fill(-1)
592613

614+
if oldLength == 0 or newLength == 0:
615+
return fill_vec
616+
593617
oldPos = oldLength - 1
594618
newPos = newLength - 1
595619

@@ -639,6 +663,9 @@ def backfill_int64(ndarray[int64_t] oldIndex,
639663
fill_vec = np.empty(len(newIndex), dtype = np.int32)
640664
fill_vec.fill(-1)
641665

666+
if oldLength == 0 or newLength == 0:
667+
return fill_vec
668+
642669
oldPos = oldLength - 1
643670
newPos = newLength - 1
644671

@@ -688,6 +715,9 @@ def backfill_bool(ndarray[uint8_t] oldIndex,
688715
fill_vec = np.empty(len(newIndex), dtype = np.int32)
689716
fill_vec.fill(-1)
690717

718+
if oldLength == 0 or newLength == 0:
719+
return fill_vec
720+
691721
oldPos = oldLength - 1
692722
newPos = newLength - 1
693723

pandas/tests/test_frame.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,13 @@ def test_icol(self):
841841
expected = df.ix[:, 8:14]
842842
assert_frame_equal(result, expected)
843843

844+
def test_iget_value(self):
845+
for i, row in enumerate(self.frame.index):
846+
for j, col in enumerate(self.frame.columns):
847+
result = self.frame.iget_value(i, j)
848+
expected = self.frame.get_value(row, col)
849+
assert_almost_equal(result, expected)
850+
844851
_seriesd = tm.getSeriesData()
845852
_tsd = tm.getTimeSeriesData()
846853

pandas/tests/test_groupby.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,12 +1254,12 @@ def test_convert_objects_leave_decimal_alone(self):
12541254
labels = np.array(['a', 'b', 'c', 'd', 'e'], dtype='O')
12551255

12561256
def convert_fast(x):
1257-
return Decimal(x.mean())
1257+
return Decimal(str(x.mean()))
12581258

12591259
def convert_force_pure(x):
12601260
# base will be length 0
12611261
assert(len(x.base) == len(x))
1262-
return Decimal(x.mean())
1262+
return Decimal(str(x.mean()))
12631263

12641264
grouped = s.groupby(labels)
12651265

pandas/tests/test_series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ def test_map_int(self):
16091609
def test_map_decimal(self):
16101610
from decimal import Decimal
16111611

1612-
result = self.series.map(Decimal)
1612+
result = self.series.map(lambda x: Decimal(str(x)))
16131613
self.assert_(result.dtype == np.object_)
16141614
self.assert_(isinstance(result[0], Decimal))
16151615

pandas/tests/test_tseries.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,32 @@ def test_get_reverse_indexer():
236236
expected = np.array([4, 2, 3, 6, 7], dtype='i4')
237237
assert(np.array_equal(result, expected))
238238

239+
def test_pad_backfill_object_segfault():
240+
from datetime import datetime
241+
old = np.array([], dtype='O')
242+
new = np.array([datetime(2010, 12, 31)], dtype='O')
243+
244+
result = lib.pad_object(old, new, lib.map_indices_object(old),
245+
lib.map_indices_object(new))
246+
expected = np.array([-1], dtype='i4')
247+
assert(np.array_equal(result, expected))
248+
249+
result = lib.pad_object(new, old, lib.map_indices_object(new),
250+
lib.map_indices_object(old))
251+
expected = np.array([], dtype='i4')
252+
assert(np.array_equal(result, expected))
253+
254+
result = lib.backfill_object(old, new, lib.map_indices_object(old),
255+
lib.map_indices_object(new))
256+
expected = np.array([-1], dtype='i4')
257+
assert(np.array_equal(result, expected))
258+
259+
result = lib.backfill_object(new, old, lib.map_indices_object(new),
260+
lib.map_indices_object(old))
261+
expected = np.array([], dtype='i4')
262+
assert(np.array_equal(result, expected))
263+
264+
239265
class TestTypeInference(unittest.TestCase):
240266

241267
def test_integers(self):

pandas/tools/plotting.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ def _stringify(x):
9999
else:
100100
return str(x)
101101

102+
def format_date_labels(ax):
103+
# mini version of autofmt_xdate
104+
try:
105+
for label in ax.get_xticklabels():
106+
label.set_ha('right')
107+
label.set_rotation(30)
108+
fig = ax.get_figure()
109+
fig.subplots_adjust(bottom=0.2)
110+
except Exception: # pragma: no cover
111+
pass
112+
113+
102114
def scatter_plot(data, x, y, by=None, ax=None, figsize=None):
103115
"""
104116

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147

148148
DISTNAME = 'pandas'
149149
LICENSE = 'BSD'
150-
AUTHOR = "AQR Capital Management, LLC"
150+
AUTHOR = "The pandas Development Team"
151151
MAINTAINER = "Wes McKinney"
152152
MAINTAINER_EMAIL = "[email protected]"
153153
URL = "http://pandas.sourceforge.net"
@@ -169,7 +169,7 @@
169169
MICRO = 0
170170
ISRELEASED = False
171171
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
172-
QUALIFIER = ''
172+
QUALIFIER = 'rc1'
173173

174174
FULLVERSION = VERSION
175175
if not ISRELEASED:

0 commit comments

Comments
 (0)