Sideway
output.to from Sideway
Draft for Information Only

Content

Swap a Column
 Swap a Column
 Swap a Column
 Swap a Column
 Swap a Column
 Sources and References

Swap a Column

Swap a Column

Swap a Column
Python Code Input:
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AM
D64)] on win32
>>> import numpy as np
>>> a=np.array([0,1,2])
>>> a
array([0, 1, 2])
>>> b=a[0]
>>> b
0
>>> a[0]=a[1]
>>> a
array([1, 1, 2])
>>> a[1]=b
>>> a
array([1, 0, 2])
>>> 

Swap a Column

Swap a Column
Python Code Input:
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AM
D64)] on win32
>>> import numpy as np
>>> a=np.array([0,1,2])
>>> a
array([0, 1, 2])
>>> a[[0,1]]=a[[1,0]]
>>> a
array([1, 0, 2])
>>> a.T[[0,1]]=a.T[[1,0]]
>>> a
array([0, 1, 2])
>>>

Swap a Column

Swap a Column
Python Code Input:
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AM
D64)] on win32
>>> import numpy as np
>>> a=np.array([0,1,2])
>>> a
array([0, 1, 2])
>>> a[0], a[1] = a[1], a[0]
>>> a
array([1, 0, 2])
>>> a[0], a[1] = a[1], a[0].copy()
array([0, 1, 2])
>>>

Swap a Column

Swap a Column
Python Code Input:
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AM
D64)] on win32
>>> import numpy as np
>>> a=np.array([0,1,2])
>>> a
array([0, 1, 2])
>>> np.concatenate(([1,0], [2]))
array([1, 0, 2])
>>>

Sources and References

https://stackoverflow.com/questions/952914/how-to-make-a-flat-list-out-of-a-list-of-lists

©sideway

ID: 220100012 Last Updated: 1/12/2022 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79new

Computer

Hardware 224new

Software

Application 213

Digitization 32

Latex 52new

Manim 204

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 33new

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2022 Sideway . All rights reserved Disclaimers last modified on 06 September 2019