0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

前方平均の算出(ぴよログ 睡眠時間)

Posted at

#はじめに
ぴよログのエクスポートデータを見える化するの続きです。
前回生成したグラフに前方平均を追記します。

#追加した部分

get_array_average
def get_array_average(array, span):

    ave = 0
    ret_array = []

    for index, item in enumerate(array):
        if index <= len(array) - span:
            for i in range(span):
                ave += array[index + i]
            ret_array.append(round(ave / span, 1))
            ave = 0

    return ret_array

#結果
今回は10日間の前方平均を算出しています。
成長につれて睡眠時間が少なくなってきているのがよくわかります。
20200509_135535.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?