Skip to content

Instantly share code, notes, and snippets.

@hamx0r
hamx0r / simple_python_datasource.py
Last active December 17, 2018 23:26 — forked from linar-jether/simple_python_datasource.py
Grafana python 3 datasource - using pandas for timeseries and table data. inspired by and compatible with the simple json datasource
"""
Uses `flask_restful` and creates a Blueprint to be used by a parent project (ie a larger API project where
`/grafana/` endpoints are used by Grafana's SimpleJson plugin)
"""
from flask import Flask, request, jsonify, json, abort, Blueprint
from flask_cors import CORS, cross_origin
import flask_restful
import pandas as pd
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@hamx0r
hamx0r / welford.py
Last active March 12, 2018 06:53 — forked from alexalemi/welford.py
Python Welford Algorithm
import math
class Welford(object):
""" Implements Welford's algorithm for computing a running mean
and standard deviation as described at:
http://www.johndcook.com/standard_deviation.html
can take single values or iterables
Properties:
mean - returns the mean