var points = [{ x: 75, y: 25},{ x: 75+0.0046, y: 25}];
Run Code Online (Sandbox Code Playgroud)
我将如何迭代这一点.我想首先打印x和y值,然后打印第二个和soo ....
我无法使用下面的 mongodb 模板添加 redact 是我的 mongo 代码,它运行良好并使用了 sping mongo 1.8.5
db.abc.aggregate([
{ "$geoNear" : { near : { "type" : "Point", "coordinates" : [ 72.5, 19.8 ]
}, distanceField: "dist.calculated", maxDistance: 500000, includeLocs: "dist.location", num: 5, limit: 200, spherical: true } },
{ "$unwind" : "$items" },
{ "$redact" : {
"$cond" : {
if : { "$eq" : [ { "$cmp" : [ "$items.address", "$dist.location" ] }, 0 ] },
then : "$$KEEP",
else : "$$PRUNE"
}
}
} …Run Code Online (Sandbox Code Playgroud) 我使用以下步骤下载并安装了 datasheder:
git clone https://github.com/bokeh/datashader.git
cd datashader
conda install -c bokeh --file requirements.txt
python setup.py install
Run Code Online (Sandbox Code Playgroud)
之后,我使用像`python data.py 这样的终端运行代码,但没有显示图形;什么都没有显示。
我不确定我是否遵循了正确的步骤,有人可以帮我显示图表吗?这是我的代码:
import pandas as pd
import numpy as np
import xarray as xr
import datashader as ds
import datashader.glyphs
import datashader.transfer_functions as tf
from collections import OrderedDict
np.random.seed(1)
num=10000
dists = {cat: pd.DataFrame(dict(x=np.random.normal(x,s,num),
y=np.random.normal(y,s,num),
val=val,cat=cat))
for x,y,s,val,cat in
[(2,2,0.01,10,"d1"), (2,-2,0.1,20,"d2"), (-2,-2,0.5,30,"d3"), (-2,2,1.0,40,"d4"), (0,0,3,50,"d5")]}
df = pd.concat(dists,ignore_index=True)
df["cat"]=df["cat"].astype("category")
df.tail()
tf.shade(ds.Canvas().points(df,'x','y'))
glyph = ds.glyphs.Point('x', 'y')
canvas = ds.Canvas(plot_width=200, plot_height=200, x_range=(-8,8)y_range=(-8,8))
from datashader import …Run Code Online (Sandbox Code Playgroud)