---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-ab91df390b78> in <module>
----> 1 c=np.arange(1,13).reshape(6,2)
NameError: name 'np' is not defined
import numpy
c=np.arange(1,13).reshape(6,2)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-ab91df390b78> in <module>
----> 1 c=np.arange(1,13).reshape(6,2)
NameError: name 'np' is not defined
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-11-8536c3abef53> in <module>
----> 1 e=np.dstack((a,b))
NameError: name 'a' is not defined
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
D:\progarmdata\Anaconda3\lib\site-packages\numpy\lib\shape_base.py in split(ary, indices_or_sections, axis)
866 try:
--> 867 len(indices_or_sections)
868 except TypeError:
TypeError: object of type 'int' has no len()
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
<ipython-input-14-be1746c3d12c> in <module>
----> 1 np.dsplit(e,2)
<__array_function__ internals> in dsplit(*args, **kwargs)
D:\progarmdata\Anaconda3\lib\site-packages\numpy\lib\shape_base.py in dsplit(ary, indices_or_sections)
1034 if _nx.ndim(ary) < 3:
1035 raise ValueError('dsplit only works on arrays of 3 or more dimensions')
-> 1036 return split(ary, indices_or_sections, 2)
1037
1038 def get_array_prepare(*args):
<__array_function__ internals> in split(*args, **kwargs)
D:\progarmdata\Anaconda3\lib\site-packages\numpy\lib\shape_base.py in split(ary, indices_or_sections, axis)
868 except TypeError:
869 sections = indices_or_sections
--> 870 N = ary.shape[axis]
871 if N % sections:
872 raise ValueError(
AttributeError: 'list' object has no attribute 'shape'
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-30-6c10289a8da7> in <module>
----> 1 p
NameError: name 'p' is not defined
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-41-ab9744f3b0e8> in <module>
----> 1 y4=np.linspace(1,10,6,restep=True)
2 y4
<__array_function__ internals> in linspace(*args, **kwargs)
TypeError: _linspace_dispatcher() got an unexpected keyword argument 'restep'
y4=np.linspace(1,10,6,retstep=True)
y4
(array([ 1. , 2.8, 4.6, 6.4, 8.2, 10. ]), 1.8)
a = np.array([1,1,1,1])
b = np.array([[1],[1],[1],[1]])
e = np.dstack((a,b))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-43-3ff6a14b9efc> in <module>
1 a = np.array([1,1,1,1])
2 b = np.array([[1],[1],[1],[1]])
----> 3 e = np.dstack((a,b))
<__array_function__ internals> in dstack(*args, **kwargs)
D:\progarmdata\Anaconda3\lib\site-packages\numpy\lib\shape_base.py in dstack(tup)
721 if not isinstance(arrs, list):
722 arrs = [arrs]
--> 723 return _nx.concatenate(arrs, 2)
724
725
<__array_function__ internals> in concatenate(*args, **kwargs)
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 1 and the array at index 1 has size 4
x=np.array([[1,2,3],[4,5,6],[1,2,3]])
x.flatten()
array([1, 2, 3, 4, 5, 6, 1, 2, 3])
x.ravel()
array([1, 2, 3, 4, 5, 6, 1, 2, 3])
x.ravel("F")
array([1, 4, 1, 2, 5, 2, 3, 6, 3])
x.flatten("F")
array([1, 4, 1, 2, 5, 2, 3, 6, 3])
x.flatten()[1]=20
x
array([[1, 2, 3],
[4, 5, 6],
[1, 2, 3]])
x.ravel()[1]=20
x
array([[ 1, 20, 3],
[ 4, 5, 6],
[ 1, 2, 3]])
x.reshape(1,-1)
array([[ 1, 20, 3, 4, 5, 6, 1, 2, 3]])
x=np.array([1,2,3,6,7,8])
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-1613df480449> in <module>
----> 1 x=np.array([1,2,3,6,7,8])
NameError: name 'np' is not defined
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-26-0724c215bdca> in <module>
1 np.random.rand(3,4)
----> 2 n
NameError: name 'n' is not defined
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-29-8fc98edcd3a8> in <module>
----> 1 y=np.multiply(0.1,np.random,randn(2,3))+0.5
2 y
NameError: name 'randn' is not defined
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-32-6a0decdc2288> in <module>
----> 1 m=np.random,randint(9,size=(2,3))
2 m
NameError: name 'randint' is not defined
m=np.random.randint(9,size=(2,3))
m
array([[3, 8, 1],
[4, 2, 5]])
x="You are right"type(x)
str
asserttype(x)==str,"x is not str"
x=[1,2,3]type(x)
list
asserttype(x)==str,"x is not str"
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-36-5b482e2efed8> in <module>
----> 1 assert type(x)==str,"x is not str"
AssertionError: x is not str
A=np.arrange(95,99).reshape(2,2)
A
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-37-824c81e341b7> in <module>
----> 1 A=np.arrange(95,99).reshape(2,2)
2 A
D:\anaconda3\lib\site-packages\numpy\__init__.py in __getattr__(attr)
217 return Tester
218 else:
--> 219 raise AttributeError("module {!r} has no attribute "
220 "{!r}".format(__name__, attr))
221
AttributeError: module 'numpy' has no attribute 'arrange'
File "<ipython-input-44-e7ba450d70e1>", line 1
numpy.empty(shape,dtype=float,order="C)
^
SyntaxError: EOL while scanning string literal
numpy.empty(shape,dtype=float,order="C")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-45-43678a75714b> in <module>
----> 1 numpy.empty(shape,dtype=float,order="C")
NameError: name 'numpy' is not defined
c=np.array([[1,2],[3,4]])
c
array([[1, 2],
[3, 4]])
c.astype(np.float32)
array([[1., 2.],
[3., 4.]], dtype=float32)
x=np.array([1,3,5])
y=np.array([4,6])
XX,YY=np.meshgrid(x,y)
XX