データ型の種類 (python)



Python
Pythonとは
基本的な使い方
・IDLE

・Jupyter Notebook

・Markdown

・コマンドプロンプトで実行

・仮想環境の構築

・仮想環境でIDLEを実行

ライブラリのインストール
・pipの使い方

・numpy , matplotlib等

・graphviz

・pytorch

・Mecab

Pythonの関数:一覧
共通関数
・append , extend

・class

・copy

・csv.reader

・csv.writer

・def , return

・dict , defaultdict

・enumerate

・exit

・for

・if

・import

・in

・input

・lambda

・len

・list

・min/max

・OrderedDict

・open/close

・os

・pickle

・print

・range

・re.split

・read/readline

・round/floor/ceil

・split

・sys.argv

・time

・while

・write

・zip

・特殊メソッド
 ・__name__

 ・__iter__ , __next__

・正規表現、メタ文字

・データの型の種類

・四則演算 (+ , - , * , /)

・コメントアウト (# , ''')

numpy
・append

・arange

・argmax/argmin

・array

・asfarray

・astype , dtype

・digitize

・dot

・hstack/vstack

・linalg.solve

・linspace

・max,min

・mean

・meshgrid

・mgrid

・ndim

・ndmin

・pad

・poly1d

・polyfit

・prod

・random

・reshape

・savetxt/loadtxt

・shape

・std

・transpose

・where

・zeros/zeros_like

scipy
・expit

・imread

・interpolate

・signal.square, sawtooth

matplotlib
・contour

・imshow

・figure

・pcolormesh

・plot

・quiver

・scatter

scikit-learn
・GaussianNB

・KMeans

・KNeighborsClassifier

・SVC

・tree

chaospy

keras

chainer

chainerrl

pandas
・データ抽出

・concat

・DataFrame

・read_excel

pytorch
・BCELoss , MSELoss

・Embedding

・device

・Sequential

・Dataset, Dataloader

・RNN, LSTM

OpenAI gym
・Blackjack-v0

・CartPole-v0

seaborn
・pairplot

tkinter
・frame, grid

・画像表示

・画像を切り取り表示

・画像を保存

目的別
・ステップ関数

・矩形波, 三角波

・1 of K 符号化法

・線形補間

・配列に番号をつける

・ベクトル場を描く

・線形回帰, 多項式回帰

・Bluetooth接続


公開日:2020/5/4 , 最終更新日:2021/6/17         

■説明
pythonで扱うデータ型には以下の種類があります。

 bool:真偽 (FalseかTrueを出力、booleanの略)
 int :整数 (integerの略)
 float:浮動小数点
 str :文字列 (stringの略)
 list : リスト
 tuple:タプル
 dict:辞書

■具体例
<データの型を調べる:type>
type関数を使うことで、データの型を調べることができます。

a =1
type(a)

 <class 'int'>

a =True
type(a)

 <class 'bool'>

a =1.0
type(a)

 <class 'float'>

a ='1'
type(a)

 <class 'str'>


<データの型を変換する>
配列の型を変換するには、astype,dtypeを使用します。

a =1.8
int(a)

 1  # intに変換すると、小数点は切り捨てされる。

str(a)

 '1.8'

bool(a)

 True


<dict型について>
dict型は、要素に対して値を付与できる型で、要素を指定すると値が返ってきます。

a= {'dog': 2, 'cat': 2, 'lion': [1,3], 'dog': 5}
a

 {'dog': 5, 'cat': 2, 'lion': [1, 3]}   # 同じ要素が含まれると、最後の要素以外は除外される

a['lion']

 [1, 3]

a['lion'][0]

 1










サブチャンネルあります。⇒ 何かのお役に立てればと

関連記事一覧



Python
Pythonとは
基本的な使い方
・IDLE

・Jupyter Notebook

・Markdown

・コマンドプロンプトで実行

・仮想環境の構築

・仮想環境でIDLEを実行

ライブラリのインストール
・pipの使い方

・numpy , matplotlib等

・graphviz

・pytorch

・Mecab

Pythonの関数:一覧
共通関数
・append , extend

・class

・copy

・csv.reader

・csv.writer

・def , return

・dict , defaultdict

・enumerate

・exit

・for

・if

・import

・in

・input

・lambda

・len

・list

・min/max

・OrderedDict

・open/close

・os

・pickle

・print

・range

・re.split

・read/readline

・round/floor/ceil

・split

・sys.argv

・time

・while

・write

・zip

・特殊メソッド
 ・__name__

 ・__iter__ , __next__

・正規表現、メタ文字

・データの型の種類

・四則演算 (+ , - , * , /)

・コメントアウト (# , ''')

numpy
・append

・arange

・argmax/argmin

・array

・asfarray

・astype , dtype

・digitize

・dot

・hstack/vstack

・linalg.solve

・linspace

・max,min

・mean

・meshgrid

・mgrid

・ndim

・ndmin

・pad

・poly1d

・polyfit

・prod

・random

・reshape

・savetxt/loadtxt

・shape

・std

・transpose

・where

・zeros/zeros_like

scipy
・expit

・imread

・interpolate

・signal.square, sawtooth

matplotlib
・contour

・imshow

・figure

・pcolormesh

・plot

・quiver

・scatter

scikit-learn
・GaussianNB

・KMeans

・KNeighborsClassifier

・SVC

・tree

chaospy

keras

chainer

chainerrl

pandas
・データ抽出

・concat

・DataFrame

・read_excel

pytorch
・BCELoss , MSELoss

・Embedding

・device

・Sequential

・Dataset, Dataloader

・RNN, LSTM

OpenAI gym
・Blackjack-v0

・CartPole-v0

seaborn
・pairplot

tkinter
・frame, grid

・画像表示

・画像を切り取り表示

・画像を保存

目的別
・ステップ関数

・矩形波, 三角波

・1 of K 符号化法

・線形補間

・配列に番号をつける

・ベクトル場を描く

・線形回帰, 多項式回帰

・Bluetooth接続