Here is a simple code to generate synthetic time series.
import numpy as np
import pandas as pd
med = 15.5
dp = 8.2
sDays = np.arange('2001-01', '2016-12', dtype='datetime64[D]')
nDays = len(sDays)
s1 = np.random.gumbel(loc=med,scale=dp,size=nDays)
s1[s1 < 0] = 0
dfSint = pd.DataFrame({'Q':s1},index=sDays)
dfSint.plot()
Python programming, with examples in hydraulic engineering and in hydrology.
Showing posts with label statistics. Show all posts
Showing posts with label statistics. Show all posts
Friday, June 30, 2017
Sunday, December 6, 2015
Probability: How to do combinations without repetition
Command:
itertools.combinations(iterable, r)
Return r length subsequences of elements from the input iterable.
Combinations are emitted in lexicographic sort order. So, if the input iterable is sorted, the combination tuples will be produced in sorted order.
Elements are treated as unique based on their position, not on their value. So if the input elements are unique, there will be no repeat values in each combination.
Example:
from itertools import combinations print list(combinations([1,2,3,4], 3))itertools.combinations returns an iterator. An iterator is something that you can for on. So, that is why it is transformed into a list in the example.
Subscribe to:
Posts (Atom)