Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python NumPy tile Function Example

# welcome to softhunt.net
# Python Program illustrating
# numpy.tile()

import numpy as np

arr = np.arange(3)
print("arr : 
", arr)

a = 2
b = 2
repetitions = (a, b)
print("
Repeating arr : 
", np.tile(arr, repetitions))
print("arr Shape : 
", np.tile(arr, repetitions).shape)

a = 3
b = 2
repetitions = (a, b)
print("
Repeating arr : 
", np.tile(arr, repetitions))
print("arr Shape : 
", np.tile(arr, repetitions).shape)

a = 2
b = 3
repetitions = (a, b)
print("
Repeating arr : 
", np.tile(arr, repetitions))
print("arr Shape : 
", np.tile(arr, repetitions).shape)
Comment

Python NumPy tile Function Example Working with 1D array

# welcome to softhunt.net
# Python Program illustrating
# numpy.tile()

import numpy as np

#Working on 1D
arr = np.arange(5)
print("arr : 
", arr)

repetitions = 2
print("Repeating arr 2 times : 
", np.tile(arr, repetitions))

repetitions = 3
print("
Repeating arr 3 times : 
", np.tile(arr, repetitions))
# [0 1 2 ..., 2 3 4] means [0 1 2 3 4 0 1 2 3 4 0 1 2 3 4]
# since it was long output, so it uses [ ... ]
Comment

Python NumPy tile Function Syntax

numpy.tile(arr, repetitions)
Comment

PREVIOUS NEXT
Code Example
Python :: generate python 
Python :: dictionary multiple values per key 
Python :: numpy argsort 
Python :: Smart Weather Information App Using Python 
Python :: quicksort algorithm in python 
Python :: what does the combinations itertools in python do 
Python :: add vertical line in plot python 
Python :: python program to calculate the average of numbers in a given list 
Python :: python how to create a function 
Python :: python named tuples 
Python :: python check empty string 
Python :: += in python 
Python :: class decorator python 
Python :: add item to list python 
Python :: request foucus tkinter widget 
Python :: python all() function 
Python :: pandas weighted average groupby 
Python :: list all files in a folder 
Python :: datetime conversion 
Python :: aws python sdk 
Python :: streamlit cheatsheet 
Python :: object oriented python 
Python :: python create empty list size n 
Python :: regex python 
Python :: how to get the length of a string in python stack overflow 
Python :: python copy list 
Python :: python file 
Python :: how to return the sum of two numbers python 
Python :: depth first search 
Python :: .save() in django 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =