Pandas 不是密谋代码。
Pandas not plotting code.
我是编码新手,我试图通过阅读代码来理解关于 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();
唯一的输出,当我运行这个时,是:"Process finished with exit code 0"
只需要在末尾加上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()
我是编码新手,我试图通过阅读代码来理解关于 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();
唯一的输出,当我运行这个时,是:"Process finished with exit code 0"
只需要在末尾加上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()