小编hbr*_*ell的帖子

在 Julia 中的数据帧上绘制简单移动平均值

我有一个包含日期和股票价格的 Excel 文件。我使用 DataFrames.jl 将此数据读入数据帧

\n
using DataFrames, StatsPlots, Indicators\n\ndf = DataFrame(XLSX.readtable("Demo-sv.xlsx", "Blad3")...)\n
Run Code Online (Sandbox Code Playgroud)\n

这非常有效,我在这里打印了前 6 个条目。

\n
6\xc3\x972 DataFrame\n\xe2\x94\x82 Row \xe2\x94\x82 Date       \xe2\x94\x82 Closeprice \xe2\x94\x82\n\xe2\x94\x82     \xe2\x94\x82 Any        \xe2\x94\x82 Any        \xe2\x94\x82\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xbc\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xbc\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xa4\n\xe2\x94\x82 1   \xe2\x94\x82 2019-05-03 \xe2\x94\x82 169.96     \xe2\x94\x82\n\xe2\x94\x82 2   \xe2\x94\x82 2019-05-02 \xe2\x94\x82 168.06     \xe2\x94\x82\n\xe2\x94\x82 3   \xe2\x94\x82 2019-04-30 \xe2\x94\x82 165.58     \xe2\x94\x82\n\xe2\x94\x82 4   \xe2\x94\x82 2019-04-29 \xe2\x94\x82 166.4      \xe2\x94\x82\n\xe2\x94\x82 5   \xe2\x94\x82 2019-04-26 \xe2\x94\x82 167.76     \xe2\x94\x82\n\xe2\x94\x82 6   \xe2\x94\x82 2019-04-25 \xe2\x94\x82 167.46     \xe2\x94\x82\n
Run Code Online (Sandbox Code Playgroud)\n

然后我使用 StatsPlots.jl 绘制这些数据@df df plot(df.Date, df.Closeprice)并得到一个漂亮的绘图。

\n

问题是当我想用 Indicators.jl 绘制简单的移动平均线时 …

julia julia-dataframe julia-plots

6
推荐指数
1
解决办法
1346
查看次数

删除另一个列表中列表中的第二个值

我有一个包含许多其他内部列表的列表,其中一些内部列表包含两个值.我想删除内部列表中的所有第二个值.

[['a'], ['b'], ['c', 'd'], ['e'], ['f', 'g']]
Run Code Online (Sandbox Code Playgroud)

我可以使用rsplit(),还是有更好的其他拆分功能?

python python-3.x

1
推荐指数
1
解决办法
51
查看次数

使用字典迭代 json 列表

我有一个 json 文件,其中包含一个包含许多字典的列表。这里我只列出了两个。但我想遍历所有字典并只获取代码值(Company1 和 Company2)。

[{"code":"Company1","exchange_short_name":"ST","date":"2000-01-01"},
{"code":"Company2","exchange_short_name":"ST","date":"2000-01-01"}]
Run Code Online (Sandbox Code Playgroud)

我已经做到了这一点,但它给了我字典中的所有值,而不是代码值。

for d in jsonData:
   for key in d:
       print(d[key])
Run Code Online (Sandbox Code Playgroud)

python json python-3.x

0
推荐指数
1
解决办法
3040
查看次数

标签 统计

python ×2

python-3.x ×2

json ×1

julia ×1

julia-dataframe ×1

julia-plots ×1