append more columns into a 2d array
# To create 2 or more dimensional Arrays in python
# A two-dimensional array(list) is like a table with rows and columns.

# Assume there are 1, 2, 3 to n rows and 1, 2, 3 to n colums of data
# Let data at row 1,column 1; row 2, column 2, correspond to d11, d22

#       col1 col2 ... coln
# row1  d11  d12  ... d1n
# row2  d21  d22  ... d2n
# .		 .    .   ...  .
# . 	 .    .   ...  .
# . 	 .    .   ...  .
# rown  dn1  dn2 ... dnn

# Syntax of 2d array in python:
# [[d11,d12,d13,..,d1n],[d21,d22,d23,.......,d2n]]

# Example: Following is the example for creating
# 2D array with 4 rows and 5 columns

array=[[23,45,43,23,45],[45,67,54,32,45],[89,90,87,65,44],[23,45,67,32,10]]

#display
print(array)


# Accessing the values using index position

# Syntax:
# 1)	Get row value using [] operator
#		i.e array[row index]
# 2) 	Get column value using [][]
#	    i.e array[row index][column index]
# where,
#	row index is the row position starts from 0
#	column index is the column position starts from 0 in a row.

# For instance:
# get the first row
print(array[0])

# get the third row
print(array[2])

#get the element at the first row and the third column
print(array[0][2])

# get the element (value) at the third row and forth column
print(array[2][3])

# Output:
# [[23, 45, 43, 23, 45], [45, 67, 54, 32, 45], [89, 90, 87, 65, 44], [23, 45, 67, 32, 10]]
# [23, 45, 43, 23, 45]
# [89, 90, 87, 65, 44]
# 43
# 65


# Inserting values into two-dimensional array using the insert() function
# Syntax:
# array.insert(index,[values])

# where,
#	the index is the row position to insert a particular row
# 	[values] are the values to be inserted into the array.
#	It must a list of values. It could be same length (5) as columns above 


# Example:
# insert 5 new data at the third row
array.insert(2, [1,2,3,4,5])

#insert another column of data at the 6th row
array.insert(5, [8,9,10,11,12])

#display
print(array)
Output:
[[23, 45, 43, 23, 45], [45, 67, 54, 32, 45], [1, 2, 3, 4, 5], [89, 90, 87, 65, 44], [23, 45, 67, 32, 10], [8,9,10,11,12]]

Python相关代码片段

drop one table sqlalchemy

python code to remove last character from string

fastapi get body on http middleware

custom neural network in keras

python selenium execute_script

db model for blog

yolov5 opencv

Get first 100 lines of file - python

python playground

print number pattern using for loop in python

ollama python

no module named 'wget'

No module named 'langchain'

failed to build wxpython

python vs c#

rabbitmq python example

change the django url prefix name

np.linspace is not defined python

LLM beguiner guide python

python parquet file to csv

python best practices

yolov5 without net

save variable as pkl python

python [-9:]

eigenface python

'DataFrame' object has no attribute 'dtype'

unable to enable maximize window tkinter

rabbit and fox numpy python

lstm in keras

neural network in keras

resnet50 in keras

autoencoder in keras

cnn in keras

tensor in keras

pyTelegramBotAPI edit photo

print api python

how to get values but not index from pandas series

how to get mode of a column from pandas

bayesian neural network pymcmc

lda python

back propagation python

logical syntax is not none python

register model django

Descending Selection sort

Selection sort with while loops

Selection sort with for loops

Doubling Algorithm for cluster analysis in python

Tkinter widgets

nameerror: name 'callable' is not defined

NameError: name 'Union' is not defined

Make a widget customtkinter python

nn module pytorch

import tf python

Spark SEssion object

Implement Bubble sort with while loops

Unoptimized bubble sort algorithm

Optimized bubble sort algorithm

how to get today's date in python

st_aggrid install

python venv pip blocked by admin windows

numpy matrix from lists of different leght

python postgres auto commit

dotenv install python

np mean axis

LinkExtractor Object

admin django documentation

Python native Convolution implementation

is django monolithic

what is function call with an llm

np array to series

dht22 micropython pico

disable slash command discord.py

python docker compose not printing

tabnet probabilities

python venv: no such file or directory

find most common words in string python

histogram equalization using pillow

Django squash migrations

swap first and last letter in string in array

sor a lit in python