diff --git a/pandas/core/frame.py b/pandas/core/frame.py index eaf731040c058..2b458c05f35fe 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -278,6 +278,9 @@ def iteritems(self): """Iterator over (column, series) pairs""" series = self._series return ((k, series[k]) for k in self.columns) + + if py3compat.PY3: + items = iteritems def __len__(self): """Returns length of index""" diff --git a/pandas/core/series.py b/pandas/core/series.py index ea9750624a2e9..54079f11bb742 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -419,6 +419,9 @@ def iteritems(self): Lazily iterate over (index, value) tuples """ return itertools.izip(iter(self.index), iter(self)) + + if py3compat.PY3: + items = iteritems #---------------------------------------------------------------------- # Arithmetic operators diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py index 60feace3ecb6d..06795d5cafd04 100644 --- a/pandas/tests/test_frame.py +++ b/pandas/tests/test_frame.py @@ -2414,23 +2414,23 @@ def test_combine_first(self): assert_frame_equal(comb, self.frame) def test_combine_first_mixed_bug(self): - idx = Index(['a','b','c','e']) - ser1 = Series([5.0,-9.0,4.0,100.],index=idx) - ser2 = Series(['a', 'b', 'c', 'e'], index=idx) - ser3 = Series([12,4,5,97], index=idx) - - frame1 = DataFrame({"col0" : ser1, - "col2" : ser2, - "col3" : ser3}) - - idx = Index(['a','b','c','f']) - ser1 = Series([5.0,-9.0,4.0,100.], index=idx) - ser2 = Series(['a','b','c','f'], index=idx) - ser3 = Series([12,4,5,97],index=idx) - - frame2 = DataFrame({"col1" : ser1, - "col2" : ser2, - "col5" : ser3}) + idx = Index(['a','b','c','e']) + ser1 = Series([5.0,-9.0,4.0,100.],index=idx) + ser2 = Series(['a', 'b', 'c', 'e'], index=idx) + ser3 = Series([12,4,5,97], index=idx) + + frame1 = DataFrame({"col0" : ser1, + "col2" : ser2, + "col3" : ser3}) + + idx = Index(['a','b','c','f']) + ser1 = Series([5.0,-9.0,4.0,100.], index=idx) + ser2 = Series(['a','b','c','f'], index=idx) + ser3 = Series([12,4,5,97],index=idx) + + frame2 = DataFrame({"col1" : ser1, + "col2" : ser2, + "col5" : ser3}) combined = frame1.combine_first(frame2) diff --git a/pandas/util/testing.py b/pandas/util/testing.py index eb5bf40f155bb..6d43682aafbfe 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -31,7 +31,7 @@ K = 4 def rands(n): - choices = string.letters + string.digits + choices = string.ascii_letters + string.digits return ''.join([random.choice(choices) for _ in xrange(n)]) #------------------------------------------------------------------------------- diff --git a/setup.py b/setup.py index 93832badaa06a..cbcf938719c00 100755 --- a/setup.py +++ b/setup.py @@ -295,13 +295,15 @@ def srcpath(name=None, suffix='.pyx', subdir='src'): 'pandas.io', 'pandas.sandbox', 'pandas.stats', - 'pandas.util'], - package_data={'pandas' : ['tests/*.py'], - 'pandas.io' : ['tests/*.py', - 'tests/*.h5', + 'pandas.util', + 'pandas.tests', + 'pandas.io.tests', + 'pandas.stats.tests', + ], + package_data={'pandas.io' : ['tests/*.h5', 'tests/*.csv', 'tests/*.xls'], - 'pandas.stats' : ['tests/*.py']}, + }, ext_modules=extensions, maintainer_email=MAINTAINER_EMAIL, description=DESCRIPTION,