takowasa280

https://www.amazon.jp/hz/wishlist/ls/1FEI82…

最近の記事

Pandasで列のヒストグラムを表示

df.hist(bins=10) #bins...分布の数 ###INPUT###hist = df3.hist(bins=30) #SalesPrice列のヒストグラム表示###OUTPUT###画像

    • Pandasで列の最大、最小、平均値などの情報を表示

      df.describe() ###INPUT###df3=df2["SalePrice"] ##SalePriceの列だけ抽出df3.describe() ##SalesPrice列の分布の情報を表示###OUTPUT###count 1460.000000mean 180921.195890std 79442.502883min 34900.00000025% 129975.00000050% 163000.0

      • Pandasで列を並び替える

        df.sort_values() #昇順に並び替えdf.sort_values(ascending=False) #降順に並び替え ###INPUT###df2_corr.sort_values(ascending=False)###OUTPUT###SalePrice 1.000000OverallQual 0.790982GrLivArea 0.708624GarageCars 0.6404

        • Pandasで特定の列だけ抽出(Python)

          df["カラム名"] ###INPUT###df2_corr["SalePrice"]###OUTPUT###Id -0.021917MSSubClass -0.084284LotArea 0.263843OverallQual 0.790982OverallCond -0.077856YearBuilt 0.522897YearRemodAdd 0.507101BsmtFinSF

        Pandasで列のヒストグラムを表示

          Pandasで相関係数を取得

          ##相関係数を取得df.corr() ###INPUT###df2_corr=df2.corr() #相関係数を取得print(df2_corr)###OUTPUT### Id MSSubClass LotArea OverallQual OverallCond \Id 1.000000 0.011156 -0.033226 -0.028365 0.012609 MSSubC

          Pandasで相関係数を取得

          Pandasで指定の型だけ抽出する (Python)

          df.select_dtypes(include='型') 数値データのみ抽出 ###INPUT###df.select_dtypes(include='int')###OUTPUT### Id MSSubClass LotArea OverallQual OverallCond YearBuilt YearRemodAdd BsmtFinSF1 BsmtFinSF2 BsmtUnfSF ... WoodDeckSF OpenPorchSF EnclosedPorch 3

          Pandasで指定の型だけ抽出する (Python)

          Pandasで列ごとの基本情報を表示(Python)

          ##有効データ数,データ型,メモリ使用量等の情報を表示df.info() データの読み込み ###INPUT###df.info()####OUTPUT###<class 'pandas.core.frame.DataFrame'>RangeIndex: 1460 entries, 0 to 1459Data columns (total 81 columns):Id 1460 non-null int64MSSubClass 14

          Pandasで列ごとの基本情報を表示(Python)

          Pandasで全ての列の名前を表示(Python)

          print(df.columns) columnsは列という意味でカラムと読みます。 データの読み込みはこちらから ###INPUT###print(df.columns)###OUTPUT###Index(['Id', 'MSSubClass', 'MSZoning', 'LotFrontage', 'LotArea', 'Street', 'Alley', 'LotShape', 'LandContour', 'Utilities', 'LotConfig

          Pandasで全ての列の名前を表示(Python)

          Pandasで行数、列数を取得する(Python)

          len(df) #行数取得len(df.columns) #列数取得 データの読み込みはこちらから 実際に行数、列数を取得して出力 ###INPUT###print(len(df),len(df.columns))print("Rows=",str(len(df)), ",Columns=",str(len(df.columns)))###OUTPUT###1460 81Rows= 1460 ,Columns= 81​

          Pandasで行数、列数を取得する(Python)

          Pandasでのデータの読みこみ、表示(Python)

          mac OS , Jupyter Notebook #データをファイルから読み込んで変数dfに保存df = pd.read_csv('パス名')#読み込んだデータを表示df.head() #最初の5行を表示df.head(10) #最初の10行を表示df.tail() #最後の5行を表示df.tail(10) #最後の10行を表示 実際にボストンの住宅データを読み込む import pandas as pddf = pd.read_csv('パス名') #in

          Pandasでのデータの読みこみ、表示(Python)

          [wget]が使用できない時

          環境macOS Catalina バージョン:10.15.1 エラー内容wgetコマンドを実行したところ以下のようなエラー #input$ wget http://~~~~~~~~~~~~~#output-bash: wget: command not found wget :指定したURLのファイルをダウンロード 解決策Homebrew を使って wgetコマンドをインストール #input$ brew install wget#output==> Install

          [wget]が使用できない時

          openCVでの画像の読み込み(Python)

          openCVでの画像の読みこみ img1 = cv2.imread("パス名")img2 = cv2.imread("パス名") #グレースケール パス名を変数に入れるとパス名の入力、変更が一箇所で済むので見やすくなる。 img_path = 'パス名'image = cv2.imread(img_path)

          openCVでの画像の読み込み(Python)