@@ -671,7 +671,7 @@ def element_equal(a1, a2, rtol=0, atol=0, nan_equals=False):
671671 import warnings
672672 warnings .warn ("element_equal() is deprecated. Use array1.eq(array2, rtol, atol, nan_equals) instead." ,
673673 FutureWarning , stacklevel = 2 )
674- a1 = aslarray (a1 )
674+ a1 = asarray (a1 )
675675 return a1 .eq (a2 , rtol , atol , nan_equals )
676676
677677
@@ -704,7 +704,7 @@ class Array(ABCArray):
704704 r"""
705705 An Array object represents a multidimensional, homogeneous array of fixed-size items with labeled axes.
706706
707- The function :func:`aslarray ` can be used to convert a NumPy array or Pandas DataFrame into an Array.
707+ The function :func:`asarray ` can be used to convert a NumPy array or Pandas DataFrame into an Array.
708708
709709 Parameters
710710 ----------
@@ -1810,7 +1810,7 @@ def align(self, other, join='outer', fill_value=nan, axes=None):
18101810 ValueError: Both arrays are not aligned because align method with join='exact'
18111811 expected Axis(['a0', 'a1'], 'a') to be equal to Axis(['a0', 'a1', 'a2'], 'a')
18121812 """
1813- other = aslarray (other )
1813+ other = asarray (other )
18141814 # reindex does not currently support anonymous axes
18151815 if any (name is None for name in self .axes .names ) or any (name is None for name in other .axes .names ):
18161816 raise ValueError ("arrays with anonymous axes are currently not supported by Array.align" )
@@ -5482,12 +5482,12 @@ def opmethod(self, other):
54825482 if isinstance (other , Group ) and np .isscalar (other .key ):
54835483 other = other .eval ()
54845484
5485- # we could pass scalars through aslarray too but it is too costly performance-wise for only suppressing one
5485+ # we could pass scalars through asarray too but it is too costly performance-wise for only suppressing one
54865486 # isscalar test and an if statement.
54875487 # TODO: ndarray should probably be converted to larrays because that would harmonize broadcasting rules, but
54885488 # it makes some tests fail for some reason.
54895489 if not isinstance (other , (Array , np .ndarray )) and not np .isscalar (other ):
5490- other = aslarray (other )
5490+ other = asarray (other )
54915491
54925492 if isinstance (other , Array ):
54935493 # TODO: first test if it is not already broadcastable
@@ -5662,7 +5662,7 @@ def equals(self, other, rtol=0, atol=0, nans_equal=False, check_axes=False):
56625662 Parameters
56635663 ----------
56645664 other : Array-like
5665- Input array. aslarray () is used on a non-Array input.
5665+ Input array. asarray () is used on a non-Array input.
56665666 rtol : float or int, optional
56675667 The relative tolerance parameter (see Notes). Defaults to 0.
56685668 atol : float or int, optional
@@ -5777,7 +5777,7 @@ def equals(self, other, rtol=0, atol=0, nans_equal=False, check_axes=False):
57775777 False
57785778 """
57795779 try :
5780- other = aslarray (other )
5780+ other = asarray (other )
57815781 except Exception :
57825782 return False
57835783 try :
@@ -5794,7 +5794,7 @@ def eq(self, other, rtol=0, atol=0, nans_equal=False):
57945794 Parameters
57955795 ----------
57965796 other : Array-like
5797- Input array. aslarray () is used on a non-Array input.
5797+ Input array. asarray () is used on a non-Array input.
57985798 rtol : float or int, optional
57995799 The relative tolerance parameter (see Notes). Defaults to 0.
58005800 atol : float or int, optional
@@ -5855,7 +5855,7 @@ def eq(self, other, rtol=0, atol=0, nans_equal=False):
58555855 a a0 a1 a2
58565856 True True True
58575857 """
5858- other = aslarray (other )
5858+ other = asarray (other )
58595859
58605860 if rtol == 0 and atol == 0 :
58615861 if not nans_equal :
@@ -6406,7 +6406,7 @@ def expand(v, length):
64066406 values = [value [[k ]] for k in value .axes [axis ]]
64076407 else :
64086408 values = expand (value , num_inserts )
6409- values = [aslarray (v ) if not isinstance (v , Array ) else v
6409+ values = [asarray (v ) if not isinstance (v , Array ) else v
64106410 for v in values ]
64116411
64126412 if label is not None :
@@ -8038,7 +8038,7 @@ def larray_equal(a1, a2):
80388038 msg = "larray_equal() is deprecated. Use Array.equals() instead."
80398039 warnings .warn (msg , FutureWarning , stacklevel = 2 )
80408040 try :
8041- a1 = aslarray (a1 )
8041+ a1 = asarray (a1 )
80428042 except Exception :
80438043 return False
80448044 return a1 .equals (a2 )
@@ -8049,13 +8049,13 @@ def larray_nan_equal(a1, a2):
80498049 msg = "larray_nan_equal() is deprecated. Use Array.equals() instead."
80508050 warnings .warn (msg , FutureWarning , stacklevel = 2 )
80518051 try :
8052- a1 = aslarray (a1 )
8052+ a1 = asarray (a1 )
80538053 except Exception :
80548054 return False
80558055 return a1 .equals (a2 , nans_equal = True )
80568056
80578057
8058- def aslarray (a , meta = None ):
8058+ def asarray (a , meta = None ):
80598059 r"""
80608060 Converts input as Array if possible.
80618061
@@ -8075,15 +8075,15 @@ def aslarray(a, meta=None):
80758075 --------
80768076 >>> # NumPy array
80778077 >>> np_arr = np.arange(6).reshape((2,3))
8078- >>> aslarray (np_arr)
8078+ >>> asarray (np_arr)
80798079 {0}*\{1}* 0 1 2
80808080 0 0 1 2
80818081 1 3 4 5
80828082 >>> # Pandas dataframe
80838083 >>> data = {'normal' : pd.Series([1., 2., 3.], index=['a', 'b', 'c']),
80848084 ... 'reverse' : pd.Series([3., 2., 1.], index=['a', 'b', 'c'])}
80858085 >>> df = pd.DataFrame(data)
8086- >>> aslarray (df)
8086+ >>> asarray (df)
80878087 {0}\{1} normal reverse
80888088 a 1.0 3.0
80898089 b 2.0 2.0
@@ -8108,6 +8108,9 @@ def aslarray(a, meta=None):
81088108 return Array (a , meta = meta )
81098109
81108110
8111+ aslarray = renamed_to (asarray , 'aslarray' )
8112+
8113+
81118114def _check_axes_argument (func ):
81128115 @functools .wraps (func )
81138116 def wrapper (* args , ** kwargs ):
@@ -9319,7 +9322,7 @@ def stack_one(array_name):
93199322 return Session ([(array_name , stack_one (array_name )) for array_name in array_names ], meta = meta )
93209323 else :
93219324 if res_axes is None or dtype is None :
9322- values = [aslarray (v ) if not np .isscalar (v ) else v
9325+ values = [asarray (v ) if not np .isscalar (v ) else v
93239326 for k , v in items ]
93249327
93259328 if res_axes is None :
0 commit comments