the need to replicate or repeat arrays is less common with numpy than it is with other popular array programming languages like matlab the main reason for this is that broadcasting fulfills this need betterwhich is the subject of the next section the two main tools for repeating or replicating arrays to produce larger arrays are the repeat and tile functions repeat replicates each element in an array some number of timesproducing larger arrayin [ ]arr np arange( in [ ]arr repeat( out[ ]array([ ]by defaultif you pass an integereach element will be repeated that number of times if you pass an array of integerseach element can be repeated different number of timesin [ ]arr repeat([ ]out[ ]array([ ]multidimensional arrays can have their elements repeated along particular axis in [ ]arr randn( in [ ]arr out[ ]array([ - ] ]]in [ ]arr repeat( axis= out[ ]array([ - ] - ] ] ]]note that if no axis is passedthe array will be flattened firstwhich is likely not what you want similarly you can pass an array of integers when repeating multidimensional array to repeat given slice different number of timesin [ ]arr repeat([ ]axis= out[ ]array([ - ] - ] ] ] ]]in [ ]arr repeat([ ]axis= out[ ]array([ - - - ] ]] advanced numpy www it-ebooks info