File name
Commit message
Commit date
File name
Commit message
Commit date
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"id": "4a18b98a",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "0c3e1e30",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'1.20.3'"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.__version__"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "e3b36b1f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"numpy.ndarray"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ar1 = np.array([1, 2, 3, 4, 5])\n",
"type(ar1)"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "d3fd2749",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"list"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"list1 = [[10, 20 ,30], [40, 50, 60]]\n",
"type(list1)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "f6817fb2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[10, 20, 30],\n",
" [40, 50, 60]])"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ar2 = np.array(list1)\n",
"ar2"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "734954ee",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1, 3, 5, 7, 9])"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ar3 = np.arange(1, 11, 2)\n",
"ar3"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "9288e528",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26,\n",
" 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52,\n",
" 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,\n",
" 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100])"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ar3_1 = np.arange(2, 101, 2)\n",
"ar3_1"
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "55f5ed5e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1, 2],\n",
" [3, 4],\n",
" [5, 6]])"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ar4 = np.array([1, 2, 3, 4, 5, 6]).reshape((3, 2))\n",
"ar4"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "e2888e7c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0., 0., 0.],\n",
" [0., 0., 0.]])"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ar5 = np.zeros((2, 3))\n",
"ar5"
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "833867ef",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[10, 20],\n",
" [40, 50]])"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ar6 = ar2[0:2, 0:2]\n",
"ar6"
]
},
{
"cell_type": "code",
"execution_count": 47,
"id": "3e9d7308",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([10, 20, 30])"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ar7 = ar2[0, :]\n",
"ar7"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}