brackets - Python - what is this syntax? my_2d_list[0:20,1] -
To find out what's inside the bracket, a difficult time with an interpreter is Google or nude. The reference is the code: matplotlib.mlab import from I have Tried to create a small 2D array and evaluation But he did something to me Not even thank you! The code taken from the "using the PCA (class) matplotlib.mlab library" section. Indigenous Python Lists (which you are creating for This method does not really allow you to split the way you are using it, but, you can: It seems that you may have syntax options based on some, if so, then use this great reference guide to reduce the infection: mlabPCA mlab_pca = mlabPCA (all_samples.T.) In the form of PCA ('in terms of measurement axes' from PC axis '\' standard Increased deviation: \ n ', \ mlab_pca.Wt) plt.plot (mlab_pca.Y [0: 20,0], mlab_pca.Y [0: 20,1],' o ', markers = 7, \ color =' Blue ',' alpha = 0.5, label = 'class1') plt.plot (mlab_pca.Y [20: 40,0], mlab_pca.Y [20: 40,1], '^', marker size = 7, \ Color = 'red', alpha = 0.5, label = 'class2') plt.xlabel ('x_values') plt.ylabel ('y_values') plt.xlim ([- 4,4]) plt. Ylim ([- 4,4]) plt.legend () plt.title ('matplotlib.mlab.PCA (to be replaced with class labels') plt.show ()
a = [[1,2], [1,2], [1,2], [1,2], [1] , 2]]
a [0: 2.0]
a ) Do not support indexing or skiing, at least in the way you are doing this, to use index and slice, you can use syntax, because you are already using it:
np a = np.array ([[1,2], Samples as [1,2], [1,2], [1,2], [1,2] Importing]] [0: 2, 0] # Returns array ([1, 1])
a [0 ] [1] to access 0, 1 element correctly with
a [0, 1] list. But again, a piece of action (
one [0: 2] [0] will produce some unwanted results).
Comments
Post a Comment