我一直在努力创建一个包含数百万行的 csv 图。我正在尝试使用 vaex 模块,但我被卡住了..
import vaex
# converts and reads large csv into hdf5 format
df = vaex.open("mydir/cov2.csv", convert='hdf5')
df.head()
输出
# chr pos cov index
<i style='opacity: 0.6'>0</i> NC_024468.2 1.34986e+08 6 0
<i style='opacity: 0.6'>1</i> NC_024468.2 1.34986e+08 6 1
<i style='opacity: 0.6'>2</i> NC_024468.2 1.34986e+08 6 2
csv 被转换为 hdf5 并加载,但现在有 2 个索引,1 个带有奇怪的 HTML 格式。当我尝试像在文档中那样绘制它并且在这个线程中以解决方案为基准时:
df.plot_widget(df.pos, df.cov)
我得到一个值错误。
ValueError: <bound method DataFrame.cov of
# chr pos cov index
0 NC_024468.2 134986302 6 0
1 NC_024468.2 134986303 6 1
... ... ... ... ...
2,704,117 NC_024468.2 137690419 0 2704117
2,704,118 NC_024468.2 137690420 0 2704118 > is not of string or Expression type, but <class 'method'>
解决方案是更改为 df.col.cov 或 df["cov"]。不过,现在我从 plot_widget 方法得到一个空输出:
PlotTemplate(components={'main-widget': VBox(children=(VBox(children=(Figure(axes=[Axis(color='#666', grid_col…
Plot2dDefault(w=None, what='count(*)', x='pos', y='cov', z=None)
谁能帮我?
亲切的问候,里卡多
编辑
csv 数据的样本。列 pos 在每一行(1.37 亿)上增加 1,cov 几乎总是 0,但在某些区域达到 1-400:
chr,pos,cov
NC_024468.2,1,0
NC_024468.2,2,0
NC_024468.2,3,0
.....
NC_024468.2,137690418,7
NC_024468.2,137690419,6
NC_024468.2,137690420,6