雑多な技術系メモ

自分用のメモ。内容は保証しません。よろしくお願いします。

2019-07-01から1ヶ月間の記事一覧

【matplotlib】Remove all graphs

The code how to remove all graphs plotted import matplotlib.pyplot as plt ...... plt.gca().clear()

【matplotlib】グラフの全削除

表示されているグラフの削除 import matplotlib.pyplot as plt 省略 plt.gca().clear()

pandasで移動平均を求める

サンプルコード In [3]: arr = [1,2,2,3,4,5,4,19] In [4]: mea = pd.Series(arr).rolling(window=2).mean() In [5]: print(mea) Out[5]: 0 NaN 1 1.5 2 2.0 3 2.5 4 3.5 5 4.5 6 4.5 7 11.5

ipythonでmatplotlibを使う

ipythonの起動時にpylabオプションをつける ipython --pylab 簡単なグラフをプロットしてみる In [1]: import numpy as np In [2]: import matplotlib.pyplot as plt In [3]: x = arange(10) In [4]: y = np.random.rand(10) In [5]: plt.plot(x,y) Out[5]: [<matplotlib.lines.Line2D at 0x7ff0f46f5f60></matplotlib.lines.line2d>…