import numpy as np
a = np.array([1,2,3,4,5])
slice = a[:3]
slice[0] = 100
print(a)
# result [100,2,3,4,5]

numpy Truncate the array part and python Of list The interception part is different , It doesn't create new arrays , It just points to the part of the original array , So when you modify a value in the truncated part , The original array will also be modified , They all point to the same array

## numpy Array - Cut out more related articles in the section

1. numpy Array (4)- Two dimensional array

python Create 2D  list  The way to do this is to  list  Store in  list : l = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]] numpy Can directly ...

2. numpy Array operation

numpy - Introduce . Basic data type . Multidimensional arrays ndarray And its built-in functions http://blog.csdn.net/pipisorry/article/details/22107553 http://w ...

3. java Zhongba list The list goes to arrayList as well as arraylist A simple way to intercept arrays

java Zhongba list The list goes to arrayList as well as arraylist A simple way to intercept arrays package xiaobai; import java.util.ArrayList; import java ...

4. numpy Array 、 vector 、 Matrix operations

You can come to me Github Look at the original , Welcome to exchange . https://github.com/AsuraDong/Blog/blob/master/Articles/%E6%9C%BA%E5%99%A8%E5%AD ...

5. Numpy Operations on array objects - Indexing mechanism 、 Slicing and iterative methods

In previous blog posts, I wrote about array creation and data operation , Now let's take a look at the operation of array objects . Use index and slice methods to select elements , And how to iterate arrays . One . Indexing mechanism 1. One dimensional array In [1]: a = np.arange ...

6. operation numpy Common functions of arrays

operation numpy Common functions of arrays where Use  where  Function to convert the index mask to the index position : indices = where(mask) indices => (array([11, 12, ...

7. NumPy Detailed tutorial （1）：NumPy Array

Address of the series NumPy The most detailed course (1):NumPy Array NumPy Detailed tutorial (2): data type NumPy Detailed tutorial (3):ndarray Internal mechanism and advanced iteration of List of articles Numpy Array :n ...

8. javascript Common array operations （ 1、 The whole element of the array is modified 2、 Array filtering 3、jquery Element to array 4、 Get the same or different parts of two arrays 5、 Array de duplication and reverse sort 6、 Array sorting 7、 Array truncation slice 8、 Array insertion 、 Delete splice( The location needs to be clear ) 9、 Array traversal 10、jQuery Delete the square of an array element according to its value ）

primary coverage : 1. The whole element of the array is modified 2. Array filtering 3.jquery Element to array 4. Get the same or different parts of two arrays 5. Array de duplication and reverse sort 6. Array sorting 7. Array truncation slice 8. Array insertion . Delete ...

9. NumPy Array objects

1. establish NumPy Array import numpy as np # establish 3*2*4 Three dimensional array of a = np.arange(24).reshape(3, 2, 4) # Print all elements of a 3D array print ...

## Random recommendation

1. Micro service and Docker Introduce

What is microservice One of the biggest advantages of microservice applications is , They tend to use computing resources more efficiently than traditional applications . This is because they deal with functional bottlenecks by extending components . thus , Developers only need to deploy computing resources for additional components , Instead of deploying one ...

2. Google C++ Style guide Naming conventions turn

Naming conventions The most important consistency rule is naming management . Naming styles quickly learn what a name stands for : type ? Variable ? function ? Constant ? macro ... ? You don't even need to look up type declarations . The pattern matching engine in our brain can handle this very reliably ...

3. Upload the source code to github

To  http://mac.github.com/ download github mac client And then the upper left corner + Number , Click on add add to repository( Code warehouse ), Then select the existing git project , Then click on the top right corner ...

4. JavaScript property descriptor

property descriptor (Property Descriptor) yes ES5 Then came the concept , seeing the name of a thing one thinks of its function , It's used to describe what attributes should look like , For example, read only or not , Can I enumerate , It can be configured . All object properties can be defined using property descriptors . attribute ...

5. jquery Summary -- Basics 01

jquery object ,DOM object var \$cr = \$('#cr');          var cr = \$cr[0]; /var cr = \$cr.get(0); var cr = document ...

6. word2010 How to space the contents of a table

Select the table , Then click on the arrow The following dialog box will pop up , Choose line spacing

TabbarButton.h @interface TabbarButton : UIButton @property (nonatomic, strong) UIButton *badgeValue ...

8. Source code compilation lamp Environmental Science

There is no way to use rpm Query whether a source code package is installed because It's not for rpm Installed You can do it first selinux Disable  iptables -F Delete all firewall rules First, make sure gcc  gcc-c++   ma ...

9. Monkey Analysis of test results 【 turn 】

from [http://www.douban.com/note/257030241/] Monkey Analysis of test results One . Preliminary analysis method : Monkey After a test error , The general error steps are as follows : 1. Find is ...

10. cocos2d-x Implementation of modal dialog

In bad mood , Okay . No nonsense. . Go straight to . ================================== I read an article about realizing modal dialog in Tairan , It's not bad , Then on the basis of it, I simply added a layer of gray transparent background , this ...