在子类python中调用父方法

时间:2018-05-12 17:25:30

标签: python oop tkinter nameerror

这是我的代码:

import tensorflow as tf

tf.reset_default_graph()
init_op = tf.initialize_all_variables()
tf.set_random_seed(1)
a_cC = tf.random_normal([1, 4, 4, 3], mean=1, stddev=4, seed=1)
n_H = 4
n_W = 4
a_C_unrolled = tf.reshape(a_cC,[n_H*n_W,-1])
m, n_H, n_W, n_C = a_cC.get_shape().as_list()
#run the graph
with tf.Session() as sess:
    sess.run(init_op) #execute init_op
    #print the random values that we sample
    print (a_cC.eval())
    a_cC = tf.random_normal([1, 4, 4, 3], mean=1, stddev=4, seed=1)
    a_C_unrolled = tf.reshape(a_cC,[n_H*n_W,-1])
    print(a_C_unrolled.eval())

所以,userTurn已在父类playGame中定义但是当我运行它并单击按钮c1r1时,我得到了 NameError:名称'userTurn'未定义

1 个答案:

答案 0 :(得分:0)

您需要在函数调用中添加df.melt(id_vars='customer', \ var_name='Period', \ value_name='Date'). \ groupby('customer'). \ apply(lambda x: pd.Series(pd.date_range(x.Date.min(), \ x.Date.max(), \ freq='M'))). \ reset_index(). \ drop('level_1', axis=1). \ set_index(0). \ resample('M'). \ nunique() # customer # 0 # 2015-06-30 1 # 2015-07-31 1 # 2015-08-31 1 # 2015-09-30 1 # 2015-10-31 1 。您可能应该在init中调用self

super()