Here are the examples of the python api numpy.core.atleast_2d taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : abhisuri97
Copyright MIT License
Author : abhisuri97
def test_0D_array(self):
a = array(1)
b = array(2)
res = [atleast_2d(a), atleast_2d(b)]
desired = [array([[1]]), array([[2]])]
astert_array_equal(res, desired)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : abhisuri97
Copyright MIT License
Author : abhisuri97
def test_1D_array(self):
a = array([1, 2])
b = array([2, 3])
res = [atleast_2d(a), atleast_2d(b)]
desired = [array([[1, 2]]), array([[2, 3]])]
astert_array_equal(res, desired)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : abhisuri97
Copyright MIT License
Author : abhisuri97
def test_2D_array(self):
a = array([[1, 2], [1, 2]])
b = array([[2, 3], [2, 3]])
res = [atleast_2d(a), atleast_2d(b)]
desired = [a, b]
astert_array_equal(res, desired)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : abhisuri97
Copyright MIT License
Author : abhisuri97
def test_3D_array(self):
a = array([[1, 2], [1, 2]])
b = array([[2, 3], [2, 3]])
a = array([a, a])
b = array([b, b])
res = [atleast_2d(a), atleast_2d(b)]
desired = [a, b]
astert_array_equal(res, desired)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : abhisuri97
Copyright MIT License
Author : abhisuri97
def test_r2array(self):
""" Test to make sure equivalent Travis O's r2array function
"""
astert_(atleast_2d(3).shape == (1, 1))
astert_(atleast_2d([3j, 1]).shape == (1, 2))
astert_(atleast_2d([[[3, 1], [4, 5]], [[3, 5], [1, 2]]]).shape == (2, 2, 2))