Код:
def combCreate(grp,num):
d = chain(*(map(lambda x: (combinations(x,num)),grp)))
return set(d)
# Comb DataFrame abt Freq & occured date
def combFrame(grp):
arr = df.loc[:,'date':'6th'].values
t = []
cnt = []
for i in grp:
tmp_cnt = 0
tmp_time = []
for v,date in zip(arr[:,1:],arr[:,0]):
if set(i)<=set(v):
tmp_time.append(date)
tmp_cnt=tmp_cnt+1
t.append(tuple(tmp_time))
cnt.append(tmp_cnt)
df_comb = pd.DataFrame({'cnt':cnt,'time':t},index=grp)
return df_comb
t_arr = df.loc[:,'1st':'6th'].values[:5]
comb_create = combCreate(t_arr,4)
%lprun -f combFrame(comb_create)
Когда я запускаю %lprun
в jupyter notbook, ничего не вижу, кроме UserWarning
.Я не знаю, что это значит.
/usr/local/lib/python3.6/site-packages/line_profiler.py:321: UserWarning: Could not extract a code object for the object cnt time
6 15 17 30 5 (2003-03-09 00:00:00, 2003-10-05 00:00:00, 200...
9 19 20 21 2 (2003-02-27 00:00:00, 2011-08-21 00:00:00)
4 20 21 26 2 (2003-02-27 00:00:00, 2011-05-19 00:00:00)
6 7 10 25 1 (2003-03-06 00:00:00,)
4 6 17 30 3 (2003-03-09 00:00:00, 2011-06-09 00:00:00, 201...
9 20 21 1 (2003-02-27 00:00:00,)
10 11 26 28 1 (2003-02-23 00:00:00,)
7 23 28 32 1 (2003-03-02 00:00:00,)
4 6 15 30 3 (2003-03-09 00:00:00, 2003-10-02 00:00:00, 200...
13 25 1 (2003-03-06 00:00:00,)
10 25 3 (2003-03-06 00:00:00, 2005-05-22 00:00:00, 200...
11 12 13 28 2 (2003-02-23 00:00:00, 2018-01-28 00:00:00)
7 10 13 25 5 (2003-03-06 00:00:00, 2007-01-09 00:00:00, 200...
4 19 20 21 1 (2003-02-27 00:00:00,)
1 7 10 28 1 (2003-03-02 00:00:00,)
32 3 (2003-03-02 00:00:00, 2004-02-01 00:00:00, 200...
4 15 30 31 3 (2003-03-09 00:00:00, 2006-10-31 00:00:00, 201...
6 30 31 2 (2003-03-09 00:00:00, 2013-02-07 00:00:00)
11 13 26 28 2 (2003-02-23 00:00:00, 2018-01-28 00:00:00)
10 11 12 28 2 (2003-02-23 00:00:00, 2013-07-11 00:00:00)
7 10 23 28 3 (2003-03-02 00:00:00, 2017-08-06 00:00:00, 201...
4 9 20 26 2 (2003-02-27 00:00:00, 2007-01-02 00:00:00)
7 10 28 32 1 (2003-03-02 00:00:00,)
4 7 13 25 2 (2003-03-06 00:00:00, 2010-03-07 00:00:00)
1 7 28 32 2 (2003-03-02 00:00:00, 2015-12-08 00:00:00)
10 11 12 26 4 (2003-02-23 00:00:00, 2008-10-23 00:00:00, 201...
6 17 30 31 2 (2003-03-09 00:00:00, 2004-11-30 00:00:00)
4 6 7 13 1 (2003-03-06 00:00:00,)
1 7 23 28 3 (2003-03-02 00:00:00, 2005-01-02 00:00:00, 201...
19 20 21 26 4 (2003-02-27 00:00:00, 2005-03-31 00:00:00, 200...
10 12 13 26 4 (2003-02-23 00:00:00, 2011-08-25 00:00:00, 201...
4 7 10 25 3 (2003-03-06 00:00:00, 2010-03-07 00:00:00, 201...
11 12 26 28 2 (2003-02-23 00:00:00, 2018-01-28 00:00:00)
1 7 23 32 1 (2003-03-02 00:00:00,)
4 6 15 31 1 (2003-03-09 00:00:00,)
17 31 2 (2003-03-09 00:00:00, 2007-12-02 00:00:00)
15 17 31 2 (2003-03-09 00:00:00, 2006-12-14 00:00:00)
9 21 26 4 (2003-02-27 00:00:00, 2009-02-05 00:00:00, 201...
6 15 30 31 2 (2003-03-09 00:00:00, 2005-05-19 00:00:00)
10 12 13 28 1 (2003-02-23 00:00:00,)
4 9 19 21 1 (2003-02-27 00:00:00,)
10 11 13 26 1 (2003-02-23 00:00:00,)
4 6 7 25 4 (2003-03-06 00:00:00, 2007-07-08 00:00:00, 201...
7 10 13 2 (2003-03-06 00:00:00, 2010-03-07 00:00:00)
1 10 23 28 2 (2003-03-02 00:00:00, 2016-01-07 00:00:00)
28 32 1 (2003-03-02 00:00:00,)
9 20 21 26 2 (2003-02-27 00:00:00, 2011-08-21 00:00:00)
6 7 13 25 2 (2003-03-06 00:00:00, 2003-08-10 00:00:00)
4 10 13 25 4 (2003-03-06 00:00:00, 2007-11-15 00:00:00, 201...
17 30 31 1 (2003-03-09 00:00:00,)
9 19 26 1 (2003-02-27 00:00:00,)
10 13 26 28 2 (2003-02-23 00:00:00, 2006-11-14 00:00:00)
6 7 10 13 1 (2003-03-06 00:00:00,)
4 19 20 26 2 (2003-02-27 00:00:00, 2016-03-29 00:00:00)
15 17 30 31 1 (2003-03-09 00:00:00,)
4 6 7 10 2 (2003-03-06 00:00:00, 2014-03-02 00:00:00)
6 15 17 31 2 (2003-03-09 00:00:00, 2015-02-05 00:00:00)
10 11 12 13 1 (2003-02-23 00:00:00,)
7 10 23 32 1 (2003-03-02 00:00:00,)
4 6 10 13 2 (2003-03-06 00:00:00, 2011-01-09 00:00:00)
15 17 30 1 (2003-03-09 00:00:00,)
12 13 26 28 2 (2003-02-23 00:00:00, 2018-01-28 00:00:00)
4 6 15 17 2 (2003-03-09 00:00:00, 2009-02-10 00:00:00)
9 19 21 26 4 (2003-02-27 00:00:00, 2003-03-16 00:00:00, 201...
11 12 13 26 2 (2003-02-23 00:00:00, 2018-01-28 00:00:00)
4 9 19 20 2 (2003-02-27 00:00:00, 2004-04-29 00:00:00)
19 21 26 1 (2003-02-27 00:00:00,)
10 23 28 32 2 (2003-03-02 00:00:00, 2013-07-11 00:00:00)
9 19 20 26 4 (2003-02-27 00:00:00, 2008-02-24 00:00:00, 201...
1 10 23 32 1 (2003-03-02 00:00:00,)
10 11 13 28 1 (2003-02-23 00:00:00,)
6 10 13 25 2 (2003-03-06 00:00:00, 2014-07-24 00:00:00)
1 7 10 23 2 (2003-03-02 00:00:00, 2017-04-13 00:00:00)
23 28 32 2 (2003-03-02 00:00:00, 2007-10-21 00:00:00)
10 12 26 28 2 (2003-02-23 00:00:00, 2008-08-10 00:00:00)
profile = LineProfiler(*funcs)
Надежда:
Решите это и объясните, почему.