我试图使用不同版本的python上win7,我被告知,我可以使用python laucher.
我找到了它的文档:https://docs.python.org/3/using/windows.html#launcher
但我不知道它在哪里.有人说它叫py.exe,但我的电脑上没有这个名字的文件.
我装蟒蛇3.4.3用Anaconda,https://store.continuum.io/cshop/anaconda/,自带Scipy
===========
更新:由于没有python launcer在Anacoda,我怎么可以重新安装呢?或者,如果有更好的方式使用不同的版本Win7?
我正在Rails中创建一个写作考试练习Web应用程序.问题是,如果用户的答案提交到互联网,ETS很容易检测到它们.因此,当用户在真实测试中再次写出他们的答案时,ETS会认为他们正在从互联网上回答答案并给予他们相当低的分数.
我的方法是将用户的eassay存储在会话中.所以它根本不会上传到互联网.但是,如何在会话中存储对象?
我刚刚开始使用Mac,所以如果这听起来太天真,请原谅我.
我正在尝试安装Interactive Parallel.来自https://github.com/ipython/ipyparallel,它说我需要找到jupyter_notebook_config.py.
我已经安装了python和相关软件包Anaconda,我可以使用ipython笔记本.但是,当我搜索spotlight了jupyter_notebook_config.py,我无法找到该文件:
那么,我在哪里可以找到这个文件?
更新:这是我的home文件夹:
只有anaconda.
我的情节看起来像这样:
显然,左侧和右侧是浪费空间,所以我设置
plt.axis('tight')
Run Code Online (Sandbox Code Playgroud)
但这给了我这样的情节:
xlim现在看起来很好,但ylim对于情节太紧了.
我想知道,如果我只能axis(tight)在我的情况下只设置x轴?
因此情节可能如下所示:
我当然可以手动执行此操作
plt.gca().set_xlim(left=-10, right=360)
Run Code Online (Sandbox Code Playgroud)
但我担心这不是一个非常优雅的解决方案.
要检查变量是否存在,并且如果退出,请使用原始值,否则,使用分配的新值.在红宝石中,它是
var ||= var_new
如何在python中编写它?
PS:我不知道name的||=,我根本无法在Bing搜索.
有可能写出类似的东西
.global-container
margin-top: 60px
background-image: $image-bg
@media(max-width: 767px)
margin-top: 0
background-image: none
Run Code Online (Sandbox Code Playgroud)
所以我们可以在一个类中定义桌面和移动css
我试过这个,但似乎没有用
更新:这实际上有效:http: //css-tricks.com/media-queries-sass-3-2-and-codekit/
我可以在运行代码后自动将笔记本保存为HTML.但是,有时结果生成得太快,因此输出HTML在最后一个单元格中没有输出.
我想知道,如果有可能告诉文件保存自己?
就像是
# In last cell
current_filename = 'my_file.ipynb'
save_current_notebook(current_filename)
output_HTML(current_filename)
Run Code Online (Sandbox Code Playgroud)
现在我可以逃脱:
display(Javascript("IPython.notebook.save_notebook()"),
include=['application/javascript'])
Run Code Online (Sandbox Code Playgroud) 我想创建一个带有函数的图,它将返回一个图,以便稍后我可以在需要时重新显示它.
功能如下:
def simple_plot(ax = None):
if ax is None:
fig, ax = plt.subplots()
a = [1,2,3,4]
b = [3,4,5,6]
plt.plot(a, b,'-', color='black')
return fig
Run Code Online (Sandbox Code Playgroud)
如果我跑simple_plot(),它会打印两次图,如下所示:
注意:如果我跑fig = simple_plot(),它只会打印一次,我可以fig用来在以后再现该图Ipython Notebook
如果我跑的话怎么才能打印一次simple_plot()呢?
我不确定我是否正确定义了函数,定义一个函数来制作图是一个好方法?
我知道我可以通过熊猫绘制直方图:
df4 = pd.DataFrame({'a': np.random.randn(1000) + 1})
df4['a'].hist()
Run Code Online (Sandbox Code Playgroud)
但是如何从这样的情节中检索直方图计数呢?
我知道我可以做到(来自熊猫系列的直方图值)
count,division = np.histogram(df4['a'])
Run Code Online (Sandbox Code Playgroud)
但是在df.hist()使用它之后得到计数值感觉非常多.是否可以直接从熊猫中获取频率值?
在我dataframe的时间是3列分隔:year,month,day,就像这样:

我怎样才能将它们转换成date,所以我可以进行时间序列分析?
我可以做这个:
df.apply(lambda x:'%s %s %s' % (x['year'],x['month'], x['day']),axis=1)
Run Code Online (Sandbox Code Playgroud)
这使:
1095 1954 1 1
1096 1954 1 2
1097 1954 1 3
1098 1954 1 4
1099 1954 1 5
1100 1954 1 6
1101 1954 1 7
1102 1954 1 8
1103 1954 1 9
1104 1954 1 10
1105 1954 1 11
1106 1954 1 12
1107 1954 1 13
Run Code Online (Sandbox Code Playgroud)
但接下来呢?
编辑: 这是我最终得到的:
from datetime import datetime …Run Code Online (Sandbox Code Playgroud)