让我说我有这些数据和维度:
var data = [
{"fruit": "apple", "amount": "12"},
{"fruit": "orange", "amount": "6"},
{"fruit": "grape", "amount": "11"},
{"fruit": "melon", "amount": "26"},
{"fruit": "lemon", "amount": "15"}
]
var ndx = crossfilter(data);
var fruitDimension = ndx.dimension(function (d) {
return d.fruit;
});
Run Code Online (Sandbox Code Playgroud)
...现在,我只想使用代码过滤"apple","lemon"和"orange".到现在为止,我正在尝试做类似的事情.
fruitDimension.filter(["apple","lemon","orange"])
Run Code Online (Sandbox Code Playgroud)
......但它并不都能奏效.
我知道#dimension.filterExact(value)函数适用于一个值.
如果我将#dimension.filter(value)作为参数传递给它,它将它作为#dimension.filterRange(范围)处理
我找不到哪个过滤器适用于不同的值.
参考来自:https://github.com/square/crossfilter/wiki/API-Reference
有人暗示我可以做些什么来过滤维度的不同元素(不遵循范围顺序)?
在此先感谢,罗杰
作为输入,我有一个.csv文件,例如:
user, withdraw, date
50D8BF0DA22D6C914777D8F59DAAB4D8, -125, 01-02-2015
674BCF0CD236621E5680073334A73C32, -5, 01-02-2015
E17E1691D35FB2FB675E3B787B8BEDF1, -845, 01-02-2015
50D8BF0DA22D6C914777D8F59DAAB4D8, -250, 01-02-2015
674BCF0CD236621E5680073334A73C32, -98, 01-02-2015
50D8BF0DA22D6C914777D8F59DAAB4D8, -17, 01-02-2015
Run Code Online (Sandbox Code Playgroud)
我想识别所有类似的“哈希”代码,并将其更改为诸如“ user1”,“ user2”,“ user3”等标签。
我一直在尝试这样做,但熊猫没有成功。知道我能做什么吗?