有没有办法在iPython笔记本中获取Markdown单元格以突出显示代码块中的语法?
例如,在GitHub中,可以通过以下方式获得所需的效果.
```python
>>>print('hello')
```
Run Code Online (Sandbox Code Playgroud) 我知道可以用这个periods论点来抵消,但是如何回归每月(例如交易日)的每日价格数据?
示例数据是:
In [1]: df.AAPL
2009-01-02 16:00:00 90.36
2009-01-05 16:00:00 94.18
2009-01-06 16:00:00 92.62
2009-01-07 16:00:00 90.62
2009-01-08 16:00:00 92.30
2009-01-09 16:00:00 90.19
2009-01-12 16:00:00 88.28
2009-01-13 16:00:00 87.34
2009-01-14 16:00:00 84.97
2009-01-15 16:00:00 83.02
2009-01-16 16:00:00 81.98
2009-01-20 16:00:00 77.87
2009-01-21 16:00:00 82.48
2009-01-22 16:00:00 87.98
2009-01-23 16:00:00 87.98
...
2009-12-10 16:00:00 195.59
2009-12-11 16:00:00 193.84
2009-12-14 16:00:00 196.14
2009-12-15 16:00:00 193.34
2009-12-16 16:00:00 194.20
2009-12-17 16:00:00 191.04
2009-12-18 16:00:00 194.59
2009-12-21 16:00:00 197.38
2009-12-22 16:00:00 199.50 …Run Code Online (Sandbox Code Playgroud) 我正在尝试测试如下函数中$argv第一个$argv[1]元素的长度或值:
function do-something
if test (count $argv) -lt 2 -o $argv[1] = "--help"
echo Usage ...
end
end
Run Code Online (Sandbox Code Playgroud)
但是,我收到以下错误:
? do-something
test: Missing argument at index 6
Run Code Online (Sandbox Code Playgroud)
问题在于字符串比较,但是我不确定如何使它起作用。我也尝试过-o [ $argv[1] = "--help" ],但这失败了,并出现另一个错误。
还请注意,如果我包含一个参数,这将起作用,因此fish即使第一个条件失败,它似乎也在评估第二个条件。这是错误吗?
我在比较两个DatetimeIndex不同长度的问题时遇到了一个问题assert,如下所示:
In [1]: idx1 = pd.date_range('2010-01-01','2010-12-31',freq='D')
In [2]: idx2 = pd.date_range('2010-01-01','2010-11-01',freq='D')
In [3]: assert (idx1 == idx2).all()
Run Code Online (Sandbox Code Playgroud)
我收到错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-17-ad2cfd6d11c2> in <module>()
----> 1 assert (idx1 == idx2).all()
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.10.1.dev_dcd9df7-py2.7-macosx-10.8-x86_64.egg/pandas/tseries/index.pyc in wrapper(self, other)
75 result = func(other)
76
---> 77 return result.view(np.ndarray)
78
79 return wrapper
AttributeError: 'NotImplementedType' object has no attribute 'view'
Run Code Online (Sandbox Code Playgroud)
如果没有实现,这是好的,但有没有一些熊猫这样做的方法?
注意: 我已成功使用以下内容:
In [3]: assert list(idx1) == list(idx2)
Run Code Online (Sandbox Code Playgroud)
所以,以下也有效:
In [3]: assert list(df.index) == list(testindex) …Run Code Online (Sandbox Code Playgroud) 我在graphql-tools文档中的任何地方都找不到应该如何利用enum所提供的模式中的类型makeExecutableSchema.任何人都知道这是怎么做到的?
示例代码:
enum Color {
RED
GREEN
BLUE
}
type Car {
color: Color!
}
Run Code Online (Sandbox Code Playgroud)
旋转变压器Color看起来像什么?