Assignment over slicing

While it is not possible to assign values to slices of Python lists, NumPy allows the assignment of values to NumPy arrays. For example, to assign 4 to the third to the fifth element of a NumPy one-dimensional array, we can use the following:

arr[2:5] = 4

Next, we will be looking at pandas.