这是我第一次使用results.pickle
。我正在Python中进行一些蒙特卡洛模拟,并使用以下代码在sim_results = {'n_replications': n_replications, 'p': 0, 'alpha_0': alpha_0, 'sample_size': n_sample, 'decay': decay,
'cy': cy, 'cd': cd, 'penalty_list':penalty_list, 'single_estimates': single_estimates,
'double_estimates': double_estimates, 'plot': f}
pickle_out = open('results.pickle', 'wb')
pickle.dump(sim_results, pickle_out)
pickle_out.close()
文件中存储了一些参数,一些numpy数组和matplotlib图形:
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pickle
pickle_in = open("results.pickle", 'rb')
simulation = pickle.load(pickle_in)
pickle_in.close()
之后,我正尝试使用它们将其加载到另一个Python 3.6会话中
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/Raul/anaconda3/lib/python3.6/site-packages/matplotlib/transforms.py", line 1684, in __setstate__
self._init(state['child'])
KeyError: 'child'
但是,我有这个KeyError:
final class BadgeButton: UIButton {
let badgeLabel = UILabel()
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setupView()
}
func setupView() {
self.addSubview(badgeLabel)
badgeLabel.frame = CGRect(x: self.frame.width / 2, y: 0, width: 20, height: 20)
//or you setup runTime Constraint
}
}
我已经浏览了一下,但是不知道发生了什么。你们能帮我吗?预先感谢!