Skip to content

Commit ceda3dd

Browse files
committed
xray -> xarray
1 parent 14a7e02 commit ceda3dd

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

pandas/core/generic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1041,9 +1041,9 @@ def to_clipboard(self, excel=None, sep=None, **kwargs):
10411041
from pandas.io import clipboard
10421042
clipboard.to_clipboard(self, excel=excel, sep=sep, **kwargs)
10431043

1044-
def to_xray(self):
1044+
def to_xarray(self):
10451045
"""
1046-
Return an xray object from the pandas object.
1046+
Return an xarray object from the pandas object.
10471047
10481048
Returns
10491049
-------

pandas/tests/test_generic.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -1034,17 +1034,17 @@ def test_describe_none(self):
10341034
expected = Series([0, 0], index=['count', 'unique'], name='None')
10351035
assert_series_equal(noneSeries.describe(), expected)
10361036

1037-
def test_to_xray(self):
1037+
def test_to_xarray(self):
10381038

1039-
tm._skip_if_no_xray()
1039+
tm._skip_if_no_xarray()
10401040
import xray
10411041
from xray import DataArray
10421042

10431043
if LooseVersion(xray.__version__) > '0.6.1':
10441044
# https://github.com/xray/xray/issues/697
10451045
s = Series([])
10461046
s.index.name = 'foo'
1047-
result = s.to_xray()
1047+
result = s.to_xarray()
10481048
self.assertEqual(len(result), 0)
10491049
self.assertEqual(len(result.coords), 1)
10501050
self.assertEqual(result.coords.keys(), ['foo'])
@@ -1056,7 +1056,7 @@ def test_to_xray(self):
10561056
tm.makeTimedeltaIndex]:
10571057
s = Series(range(6), index=index(6))
10581058
s.index.name = 'foo'
1059-
result = s.to_xray()
1059+
result = s.to_xarray()
10601060
repr(result)
10611061
self.assertEqual(len(result), 6)
10621062
self.assertEqual(len(result.coords), 1)
@@ -1072,12 +1072,12 @@ def test_to_xray(self):
10721072
s = Series(range(6), index=index(6))
10731073
s.index.name = 'foo'
10741074

1075-
result = s.to_xray()
1075+
result = s.to_xarray()
10761076
self.assertRaises(ValueError, lambda: repr(result))
10771077

10781078
s.index = pd.MultiIndex.from_product([['a', 'b'], range(3)],
10791079
names=['one', 'two'])
1080-
result = s.to_xray()
1080+
result = s.to_xarray()
10811081
self.assertEqual(len(result), 2)
10821082
assert_almost_equal(result.coords.keys(), ['one', 'two'])
10831083
self.assertIsInstance(result, DataArray)
@@ -1766,9 +1766,9 @@ def test_pct_change(self):
17661766

17671767
self.assert_frame_equal(result, expected)
17681768

1769-
def test_to_xray(self):
1769+
def test_to_xarray(self):
17701770

1771-
tm._skip_if_no_xray()
1771+
tm._skip_if_no_xarray()
17721772
import xray
17731773
from xray import Dataset
17741774

@@ -1785,9 +1785,9 @@ def test_to_xray(self):
17851785
)
17861786

17871787
if LooseVersion(xray.__version__) > '0.6.1':
1788-
# https://github.com/xray/xray/issues/697
1788+
# https://github.com/pydata/xarray/issues/697
17891789
df.index.name = 'foo'
1790-
result = df[0:0].to_xray()
1790+
result = df[0:0].to_xarray()
17911791
self.assertEqual(result.dims['foo'], 0)
17921792
self.assertIsInstance(result, Dataset)
17931793

@@ -1798,7 +1798,7 @@ def test_to_xray(self):
17981798
df.index = index(3)
17991799
df.index.name = 'foo'
18001800
df.columns.name = 'bar'
1801-
result = df.to_xray()
1801+
result = df.to_xarray()
18021802
self.assertEqual(result.dims['foo'], 3)
18031803
self.assertEqual(len(result.coords), 1)
18041804
self.assertEqual(len(result.data_vars), 8)
@@ -1820,26 +1820,26 @@ def test_to_xray(self):
18201820
# not implemented
18211821
df.index = pd.MultiIndex.from_product([['a'], range(3)],
18221822
names=['one', 'two'])
1823-
self.assertRaises(ValueError, lambda: df.to_xray())
1823+
self.assertRaises(ValueError, lambda: df.to_xarray())
18241824

18251825

18261826
class TestPanel(tm.TestCase, Generic):
18271827
_typ = Panel
18281828
_comparator = lambda self, x, y: assert_panel_equal(x, y)
18291829

1830-
def test_to_xray(self):
1830+
def test_to_xarray(self):
18311831

1832-
tm._skip_if_no_xray()
1832+
tm._skip_if_no_xarray()
18331833
import xray
18341834
from xray import Dataset
18351835

18361836
p = tm.makePanel()
18371837

18381838
if LooseVersion(xray.__version__) > '0.6.1':
1839-
# https://github.com/xray/xray/issues/697
1839+
# https://github.com/pydata/xarray/issues/697
18401840
pass
18411841

1842-
result = p.to_xray()
1842+
result = p.to_xarray()
18431843
self.assertIsInstance(result, Dataset)
18441844
self.assertEqual(len(result.coords), 3)
18451845
assert_almost_equal(result.coords.keys(),
@@ -1851,9 +1851,9 @@ class TestPanel4D(tm.TestCase, Generic):
18511851
_typ = Panel4D
18521852
_comparator = lambda self, x, y: assert_panel4d_equal(x, y)
18531853

1854-
def test_to_xray(self):
1854+
def test_to_xarray(self):
18551855

1856-
tm._skip_if_no_xray()
1856+
tm._skip_if_no_xarray()
18571857
import xray
18581858
from xray import Dataset
18591859

@@ -1863,7 +1863,7 @@ def test_to_xray(self):
18631863
# https://github.com/xray/xray/issues/697
18641864
pass
18651865

1866-
result = p.to_xray()
1866+
result = p.to_xarray()
18671867
self.assertIsInstance(result, Dataset)
18681868
self.assertEqual(len(result.coords), 4)
18691869
assert_almost_equal(result.coords.keys(),

pandas/util/testing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ def _skip_if_no_scipy():
215215
raise nose.SkipTest('scipy.interpolate missing')
216216

217217

218-
def _skip_if_no_xray():
218+
def _skip_if_no_xarray():
219219
try:
220220
import xray
221221
except ImportError:
222222
import nose
223-
raise nose.SkipTest("xray not installed")
223+
raise nose.SkipTest("xarray not installed")
224224

225225

226226
def _skip_if_no_pytz():

0 commit comments

Comments
 (0)