Skip to content

Commit 883224f

Browse files
author
Matt Roeschke
committed
Merge remote-tracking branch 'upstream/master' into format_np_nat_object
2 parents 0d05306 + fe1654f commit 883224f

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

doc/source/development/extending.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ decorate a class, providing the name of attribute to add. The class's
3333
3434
@staticmethod
3535
def _validate(obj):
36-
if 'lat' not in obj.columns or 'lon' not in obj.columns:
37-
raise AttributeError("Must have 'lat' and 'lon'.")
36+
# verify there is a column latitude and a column longitude
37+
if 'latitude' not in obj.columns or 'longitude' not in obj.columns:
38+
raise AttributeError("Must have 'latitude' and 'longitude'.")
3839
3940
@property
4041
def center(self):

pandas/tests/frame/test_analytics.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import numpy as np
99
import pytest
1010

11-
from pandas.compat import PY35, lrange
11+
from pandas.compat import PY2, PY35, is_platform_windows, lrange
1212
import pandas.util._test_decorators as td
1313

1414
import pandas as pd
@@ -1842,6 +1842,17 @@ def test_numpy_round(self):
18421842
with pytest.raises(ValueError, match=msg):
18431843
np.round(df, decimals=0, out=df)
18441844

1845+
@pytest.mark.xfail(
1846+
PY2 and is_platform_windows(), reason="numpy/numpy#7882",
1847+
raises=AssertionError, strict=True)
1848+
def test_numpy_round_nan(self):
1849+
# See gh-14197
1850+
df = Series([1.53, np.nan, 0.06]).to_frame()
1851+
with tm.assert_produces_warning(None):
1852+
result = df.round()
1853+
expected = Series([2., np.nan, 0.]).to_frame()
1854+
tm.assert_frame_equal(result, expected)
1855+
18451856
def test_round_mixed_type(self):
18461857
# GH 11885
18471858
df = DataFrame({'col1': [1.1, 2.2, 3.3, 4.4],

pandas/tests/series/test_analytics.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from numpy import nan
1010
import pytest
1111

12-
from pandas.compat import PY35, lrange, range
12+
from pandas.compat import PY2, PY35, is_platform_windows, lrange, range
1313
import pandas.util._test_decorators as td
1414

1515
import pandas as pd
@@ -285,6 +285,17 @@ def test_numpy_round(self):
285285
with pytest.raises(ValueError, match=msg):
286286
np.round(s, decimals=0, out=s)
287287

288+
@pytest.mark.xfail(
289+
PY2 and is_platform_windows(), reason="numpy/numpy#7882",
290+
raises=AssertionError, strict=True)
291+
def test_numpy_round_nan(self):
292+
# See gh-14197
293+
s = Series([1.53, np.nan, 0.06])
294+
with tm.assert_produces_warning(None):
295+
result = s.round()
296+
expected = Series([2., np.nan, 0.])
297+
assert_series_equal(result, expected)
298+
288299
def test_built_in_round(self):
289300
if not compat.PY3:
290301
pytest.skip(

0 commit comments

Comments
 (0)