我有一个包含日期和股票价格的 Excel 文件。我使用 DataFrames.jl 将此数据读入数据帧
\nusing DataFrames, StatsPlots, Indicators\n\ndf = DataFrame(XLSX.readtable("Demo-sv.xlsx", "Blad3")...)\nRun Code Online (Sandbox Code Playgroud)\n这非常有效,我在这里打印了前 6 个条目。
\n6\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\nRun Code Online (Sandbox Code Playgroud)\n然后我使用 StatsPlots.jl 绘制这些数据@df df plot(df.Date, df.Closeprice)并得到一个漂亮的绘图。
问题是当我想用 Indicators.jl 绘制简单的移动平均线时 …
我有一个包含许多其他内部列表的列表,其中一些内部列表包含两个值.我想删除内部列表中的所有第二个值.
[['a'], ['b'], ['c', 'd'], ['e'], ['f', 'g']]
Run Code Online (Sandbox Code Playgroud)
我可以使用rsplit(),还是有更好的其他拆分功能?
我有一个 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)