Numpy array:split

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] take tto today we will learn about AR splitting in the previous video we have learned about array join how to join two or more arrays into a single array now we will split and single array in different type different parts so split an array in three parts is this command this here we mention the number of parts we want to SPL split this is the AR definition now splitted array will be created with the function arore split this is the array then we will divide it into three parts so let's [Music] see so the array is divided into three parts now if we want to print this aray after splitting it into four parts so in that case here consider that this is an element this the number of elements in this array are six so here it is easy to divide it into equal three parts but it is difficult to divide it into equal four parts so it will do adjusting accordingly with the number of part Parts it will not give an error but it will not be a equal parts so first it will take two elements then two elements then one then one let's see so this is the element this is the element and then one element then one element so first two will be divided with will be spitted with two elements then the single element single element so here created four four arrays now if we want to print the splitted array and we want to show each part of the array in separate lines so here we can indicate it with the index 0o one or two so it will print the splitted array into separately so it is a 2d array splitted array then we will first row will print with zero second row third row now let's see so this is the splitted array now first row second row third row of this [Music] array now splitting a 2d array in this case we have to declare a 2d array so this is a 2d array with two elements in each in the First Dimension then all the 1 2 3 4 5 six elements in the second Direction so this is this is the 2D array now we want to split it into three parts the command is same only the array will be [Music] 2D so creating each of the 2D array in each parts so this is the first array this is the second array this is the third AR first array second array then third array so 2D array will be splitted into three tods now if we want to print split if you want to split the array column wise [Music] so in this case 1 4 7 10 13 will be in 1 13 and 16 will be in one AR so this is splitting in column wise now so it is print it is printed as [Music] 1 4 7 10 13 16 then 2 5 so column wise printing now this can be done by axis equal to 1 so we have to mention the axis from which axis we want to split so when we mention this XIs equal to one it will split in this [Music] direction now if we want to split this array in column column wise without mentioning the axis so the command will be eight [Music] split so H SP do the same thing print splitting the array column [Music] wise so this is our array and we want to split this column wise so this is also splitting the [Music] are column wise 2 5 8 11 14 17 second colum second array so 2 5 8 11 14 17 so a split do the same thing as ADD a split with mentioning X is equal to 1 now V split [Music] V split will do the splitting according to row which is 1 2 3 then 4 5 6 after that 7 8 9 10 11 12 and so on [Music] so we split splitted this into these three parts [Music] now this spit only works on threedimensional array or more so in this case we have to mention a three dimensional array it will split in three parts so in this spit it will do the colum wise splitting with 3D aray [Music] each the second dimension the third dimension contains one array the second dimension contains the number of elements in the second dimension of the initial array and then this will be splitted in this way so today is up to this I think if you all [Music] understand let's meet with our next video on arrays so it will continue aray are vast syllabus so we have to understand ARS if we want to work with data [Music] science so we will meet me meet with next aray videos till then practice Python Programming with aray if you have any question let me know in the comment section if you find this video useful then press the like button and share with your friends thank you for watching this video [Music]
Info
Channel: Tech Tic Tac Toe
Views: 11
Rating: undefined out of 5
Keywords: numpy, array, split, array_split, vsplit, dsplit, hsplit
Id: 4b-qf0xMScg
Channel Id: undefined
Length: 8min 16sec (496 seconds)
Published: Thu Jun 20 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.