Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def moving_average(a, window=3): | |
| """https://stackoverflow.com/a/14314054/716469 | |
| and modified to be like ``pandas.Series.rolling(window=n).mean()``: | |
| a = np.array([1,2,3,4,5]) | |
| pd.Series(a).rolling(window=3).mean().values == moving_average(a, window=3) | |
| """ | |
| ret = np.cumsum(a, dtype=float) | |
| ret[window:] = ret[window:] - ret[:-window] | |
| ret[:window-1] = np.NaN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Русификация приставок величин в pyqtgraph | |
| См. приставки по умолчанию в модулей pyqtgraph.functions: | |
| SI_PREFIXES = asUnicode('yzafpnµm kMGTPEZY') | |
| SI_PREFIXES_ASCII = 'yzafpnum kMGTPEZY' # Изменять ASCII нельзя! | |
| См. список русских обозначений приставок СИ https://ru.wikipedia.org/wiki/%D0%9F%D1%80%D0%B8%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B8_%D0%A1%D0%98 | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def colNameToNum(name): | |
| """ | |
| http://cwestblog.com/2013/09/13/python-convert-excel-column-name-to-number/ | |
| """ | |
| pow = 1 | |
| colNum = 0 | |
| for letter in name[::-1]: | |
| colNum += (int(letter, 36) -9) * pow | |
| pow *= 26 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import re | |
| def get_process_list_win32(): | |
| regexp = ur"^(?P<name>.*) \s+(?P<pid>\d+) [S|C].*$" | |
| l = [] | |
| for i in os.popen('tasklist').readlines()[5:]: | |
| g = re.search(regexp, i.decode("cp866").rstrip()) | |
| name = g.group("name").rstrip() | |
| pid = g.group("pid") |