munging¶
Useful data processing functions.
-
wechinelearn.munging.
get_dayseconds
(dt)[source]¶ Returns the number of seconds behind the most recent midnight.
For example:
get_dayseconds(datetime(2016, 9, 12, 1, 2, 3)) => 3723
.
-
wechinelearn.munging.
get_weekseconds
(dt)[source]¶ Returns the number of seconds behind the most recent midnight of a Monday.
For example:
get_weekseconds(datetime(2016, 9, 12, 0, 5, 0)) => 300.0
. Because 2016-09-12 is a Monday, and 5 minutes is 300 seconds.
-
wechinelearn.munging.
difference
(array, n=1)[source]¶ Return the differentiation of and array. By default it’s 1-order.
For example we have
array = [a1, a2, ... , a10]
. Then we havedifference(array, 1) => [(a2 - a1), (a3 - a2), ... (a10 - a9)]
difference(array, 2) => [(a3 - a1), (a4 - a2), ... (a10 - a8)]
If any error is raised, replace it with None.
中文文档
差分计算函数。在差分的过程中如果有任何异常出现, 则用None代替。