要素を None に変更すればよい。
例
arr = [1,2,3,4,5]
print(str(arr))
for i in range(len(arr)):
arr[i] = None
print(str(arr))
結果
[1, 2, 3, 4, 5]
[None, None, None, None, None]
雑記
投稿日:
要素を None に変更すればよい。
arr = [1,2,3,4,5]
print(str(arr))
for i in range(len(arr)):
arr[i] = None
print(str(arr))
[1, 2, 3, 4, 5]
[None, None, None, None, None]
執筆者:seyanen
関連記事
set size square または、その省略形で set size sq というコマンドを使えば正方形の中にグラフを描くことができる。 例 set size square plot cos(x) …
集合にモノを付け足して和集合を作るには、|= 演算子を使う。(python では、集合(set)を波かっこで囲んで表す。) 例 a = {‘東京’} b = {‘大阪’,’千葉’} c = a | b …
ヒストグラムを描くには、data_hist を使う。 ヒストグラムの縦棒の数は bins で指定する。 例 from matplotlib import pyplot as plt data_hist …
matplotlib でグラフ表示ウィンドウの画面上の位置を自由に設定する方法
matplotlib.use(‘TkAgg’) としておき、 get_current_fig_manager().window.wm_geometry(“+20+50”) として、(+20+50)のと …
matplotlib の ax でx軸、y軸の端の値を設定する
axes には、set_xlim として定義する。 例 import numpy as np from matplotlib import pyplot as plt x = np.linspace( …
2023/01/18
matplotlib のグラフ作成と gnuplot との対応 比較
2022/10/14
pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。