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 summmaryranges(nums): | |
ranges = [] | |
for num in nums: | |
if not ranges or num - ranges[-1][-1] > 1: | |
ranges.append([]) | |
ranges[-1][1:] = [num] | |
return ['->'.join(map(str, r)) for r in ranges] | |
def reverse(l, r, cl): | |
while l < r: |
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
浦发银行 | |
白云机场 | |
东风汽车 | |
中国国贸 | |
首创股份 | |
上海机场 | |
包钢股份 | |
华能国际 | |
皖通高速 | |
华夏银行 |
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
''' | |
moving avg,就是一个stream输入, | |
给一个int getNow()API获取当前timestamp, | |
完成两个函数void record(int value)和double getAvg(), | |
有输入时会自动call record,然后call getAvg()时返回5分钟内的平均值。 | |
getMedium -> quick select | |
''' | |
from collections import deque |
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 matplotlib.pyplot as plt | |
from matplotlib import animation | |
import networkx as nx | |
import os | |
import time | |
os.chdir('/Users/Cosann/Downloads/initial_graph_gml') | |
filenames = os.listdir('.') | |
filename = filenames[0] |
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
from nilearn import datasets | |
from nilearn.input_data import NiftiLabelsMasker as NLM | |
# your rawdata filename | |
filename = './tfMRI_EMOTION_RL.nii.gz' | |
# download the atlas, which has two attributes: dataset.maps, dataset.labels | |
dataset = datasets.fetch_atlas_destrieux_2009() |