1. リストの作成
new_list1 = ['TV','Car','Cloth','Food']
new_list2 = list(['TV','Car','Cloth','Food'])
print (new_list1)
print (new_list2)
演算結果:
['TV', 'Car', 'Cloth', 'Food']
['TV', 'Car', 'Cloth', 'Food']
2. よく使用されるメソッドをリストします:
1. append
new_list1 = ['TV','Car','Cloth','Food']
print (new_list1)
new_list1.append('Water') # 'water'を追加
print (new_list1)
演算結果:
['TV', 'Car', 'Cloth', 'Food']
['TV', 'Car', 'Cloth', 'Food', '水']
2.count
new_list1 = ['テレビ','車','布','食品','食品']
print (new_list1.count('食品')) #統計'食品'リスト内の回数 => 2回
3.extend
new_list1 = ['TV','Car','Cloth','Food','Food']
new_list1.extend([11, 22,33,'Car'])
print (new_list1)
演算結果:
['TV', 'Car', 'Cloth', 'Food', 'Food', 11, 22, 33, 'Car']
4.sort
new_list1 = ['TV','Car','Cloth','Food','Food']
print (new_list1)
new_list1.sort() #順方向並べ替え
print (new_list1 )
new_list1.sort(reverse=True) #逆ソート
print (new_list1)
演算結果:
['TV', 'Car', 'Cloth', 'Food', 'Food']
['Car' , ' 「布」、「食べ物」、「食品」、「テレビ」] #順ソート結果
[「テレビ」、「食べ物」、「食べ物」、「布」、「車」] #逆ソート結果
5. len
new_list1 = ['TV','Car','Food','Cloth','Food']
print (len(new_list1)) => 5 #要素の数を出力します
6.remove
new_list1 = ['TV','Car','Food','Cloth','Food']
new_list1.remove('Food')
print (new_list1)
実行結果:
[ 'TV', 'Car', 'Cloth', 'Food'] #remove は、最初に見つかった同一の要素を削除します
7.pop
new_list1 = ['TV','Car','Food', 'Cloth','Food ']
new_list1.pop() #要素をランダムに削除
print (new_list1)
new_list1.pop(2) #要素の削除を指定
print (new_list1)
演算結果は:
[' TV', 'Car ', 'Food', 'Cloth']
['TV', 'Car', 'Cloth'] #, ここで削除されるのは3番目の要素「Food」です
8.index
new_list1 = ['TV ','Car','Food','Cloth','Food']
print (new_list1.index('Food')) #指定された要素のインデックス値を返し、同じ要素に対して見つかった要素を返します。最初の
実行結果は次のとおりです: 2
9.insert
new_list1 = ['TV','Car','Food','Cloth','Food']
new_list1.insert(2,'HAHAHA' ) #指定した位置に要素を挿入
print(new_list1)
演算結果は
['TV', 'Car', 'HAHAHA', 'Food', 'Cloth', 'Food']

forhandlinglaredataSetsinpython、usenumpyArrays forbetterperformance.1)numpyarraysarememory-effictientandfasterfornumericaloperations.2)nusinnnnedarytypeconversions.3)レバレッジベクトル化は、測定済みのマネージメーシェイメージーウェイズデイタイです

inpython、listsusedynamicmemoryallocation with allocation、whilenumpyArraysalocatefixedmemory.1)listsallocatemorememorythanneededededinitivative.2)numpyArrayasallocateexactmemoryforements、rededicablebutlessflexibilityを提供します。

inpython、youcanspecthedatatypeyfelemeremodelernspant.1)usenpynernrump.1)usenpynerp.dloatp.ploatm64、フォーマーpreciscontrolatatypes。

numpyisessentialfornumericalcomputinginpythonduetoitsspeed、memory efficiency、andcomprehensivematicalfunctions.1)それは、performsoperations.2)numpyArraysaremoremory-efficientthanpythonlists.3)Itofderangeofmathematicaloperty

contiguousMemoryAllocationisucial forArraysは、ForeffienceAndfastelementAccess.1)iteenablesConstantTimeAccess、O(1)、DuetodirectAddresscalculation.2)itemprovesefficiencyByAllowingMultiblementFechesperCacheLine.3)itimplifieMememm

slicingapythonlistisdoneusingtheyntaxlist [start:stop:step] .hore'showitworks:1)startisthe indexofthefirstelementtoinclude.2)spotisthe indexofthefirmenttoeexclude.3)staptistheincrementbetbetinelements

numpyallows forvariousoperationsonarrays:1)basicarithmeticlikeaddition、減算、乗算、および分割; 2)AdvancedperationssuchasmatrixMultiplication;

Arraysinpython、特にnumpyandpandas、aresentialfordataanalysis、offeringspeedandeficiency.1)numpyarraysenable numpyarraysenable handling forlaredatasents andcomplexoperationslikemoverages.2)Pandasextendsnumpy'scapabivitieswithdataframesfortruc


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SAP NetWeaver Server Adapter for Eclipse
Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。

VSCode Windows 64 ビットのダウンロード
Microsoft によって発売された無料で強力な IDE エディター

SublimeText3 Linux 新バージョン
SublimeText3 Linux 最新バージョン

mPDF
mPDF は、UTF-8 でエンコードされた HTML から PDF ファイルを生成できる PHP ライブラリです。オリジナルの作者である Ian Back は、Web サイトから「オンザフライ」で PDF ファイルを出力し、さまざまな言語を処理するために mPDF を作成しました。 HTML2FPDF などのオリジナルのスクリプトよりも遅く、Unicode フォントを使用すると生成されるファイルが大きくなりますが、CSS スタイルなどをサポートし、多くの機能強化が施されています。 RTL (アラビア語とヘブライ語) や CJK (中国語、日本語、韓国語) を含むほぼすべての言語をサポートします。ネストされたブロックレベル要素 (P、DIV など) をサポートします。

ドリームウィーバー CS6
ビジュアル Web 開発ツール

ホットトピック









