chevron_left

メインカテゴリーを選択しなおす

cancel
arrow_drop_down
  • ランダム関数について

    numpyランダム関数を色々使ってみました.まずはインポート In [1]: import numpy as np random()は0から1までの値が得られる In [10]: np.random.random() Out[10]: 0.45226808024834264 引数を入れると,入れた数字分の乱数が得られる In [12]: np.random.random(5) Out[12]: array([ 0.93385679, 0.6383795 , 0.20373784, 0.76812241, 0.42309771]) 範囲指定は出来ないみたいです In [13]: random.u…

  • Jupyterでmatplotlibのメイリオを使うとしたらエラーが出た

    表題のような現象が見られたので,次のように書き換えてみた import matplotlib import matplotlib.pyplot as plt plt.style.use('ggplot') # ggplotを使う matplotlib.rc('font', family='sans-serif')

  • 移動平均を計算しようとすると「FutureWarning: pd.rolling_mean is deprecated for Series and will be removed in a future version, replace with ・・・」と出て来る

    FutureWarning: pd.rolling_mean is deprecated for Series and will be removed in a future version, replace with ・・・ stackoverflow.com

  • 特定の行・列を残す:Python,Numpy

    Pandasで条件を指定して行・列を抜き出すやつが有ると思います.正式名称は分かりませんが,df[val>0]みたいなやつです.Numpyのarrayでおんなじことが出来るか試したので,メモ書きしておきます.まずはこんな感じで配列を作ります.そして1個飛ばしで列を獲得できるかやってみます. In [31]: import numpy as np In [32]: a = np.array([[ 0, 1, 2, 3], ...: [ 4, 5, 6, 7], ...: [ 8, 9, 10, 11], ...: [12, 13, 14, 15]]) In [33]: label = np.ar…

  • Pythonでargmaxとかargmin

    argmaxとargminについて書いてあるようなタイトルですが,本記事ではargmaxのみです.argminも使い方は同じなので書いてません. まずは配列を用意します. In [8]: import numpy as np In [9]: a = np.array([[1,2,3],[4,5,6],[7,8,9],[2,8,2]]) あとはご覧の通り In [10]: a.argmax(axis=0) Out[10]: array([2, 2, 2], dtype=int64) In [11]: a.argmax(axis=1) Out[11]: array([2, 2, 2, 1], dt…

arrow_drop_down

ブログリーダー」を活用して、shuさんをフォローしませんか?

ハンドル名
shuさん
ブログタイトル
メモランダム!!
フォロー
メモランダム!!

にほんブログ村 カテゴリー一覧

商用