熊猫没有密码。

时间:2017-07-30 05:38:18

标签: python pandas numpy quantitative-finance

我刚接触编码,并试图通过查看代码来理解Quantopian的演讲,但是当我在PyCharm中运行代码时,没有输出。有人能告诉我发生了什么,并告诉我如何解决这个问题?

以下是我的一段代码(2.7.13):

import numpy as np
import pandas as pd

import statsmodels
import statsmodels.api as sm
from statsmodels.tsa.stattools import coint
# just set the seed for the random number generator
np.random.seed(107)

import matplotlib.pyplot as plt

X_returns = np.random.normal(0, 1, 100) # Generate the daily returns
# sum them and shift all the prices up into a reasonable range
X = pd.Series(np.cumsum(X_returns), name='X') + 50
X.plot();

当我运行它时,唯一的输出是:“处理完成退出代码0”

1 个答案:

答案 0 :(得分:1)

最后添加plt.show():

import numpy as np
import pandas as pd

import statsmodels
import statsmodels.api as sm
from statsmodels.tsa.stattools import coint
# just set the seed for the random number generator
np.random.seed(107)

import matplotlib.pyplot as plt

X_returns = np.random.normal(0, 1, 100) # Generate the daily returns
# sum them and shift all the prices up into a reasonable range
X = pd.Series(np.cumsum(X_returns), name='X') + 50
X.plot()
plt.show()