小编guz*_*man的帖子

Mixpanel数据导出由多个属性过滤

我正在尝试使用其API的Mixpanel数据导出功能.

正如预期的那样,api会要求您将请求的参数发送到URL中,然后返回json响应.

实际的请求方法基本上如下:

data = api.request(['export'], {
    'event': ['event_name'],
    'from_date': from_date,
    'to_date': to_date,
    'where': 'properties["$property_name"]!=""'
    })
Run Code Online (Sandbox Code Playgroud)

'where': 'properties["$Search Engine"]!=""'

以上仅导出设置搜索引擎的数据.除了这个规则之外,我如何包含其他过滤规则?Mixpanel文档在这个主题上似乎是免费的示例.

我试过以下:

data = api.request(['export'], {
    'event': ['event_name'],
    'from_date': from_date,
    'to_date': to_date,
    'where': 'properties["$property_name"]!=""&properties["$second_property_name"]=="value"'
    })
Run Code Online (Sandbox Code Playgroud)

但没有快乐(反应是空白的).

这里的任何帮助将不胜感激!

python api rest mixpanel

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

如何将多个参数传递给 Luigi 子任务?

我有一个路易吉任务,它是requires一个子任务。子任务取决于父任务(即正在执行操作的任务require)传递的参数。我知道您可以通过设置来指定子任务可以使用的参数...

def requires(self):
    return subTask(some_parameter)
Run Code Online (Sandbox Code Playgroud)

...然后在子任务上,通过设置接收参数...

x = luigi.Parameter()
Run Code Online (Sandbox Code Playgroud)

不过,这似乎只允许您传递一个参数。发送任意数量的参数(无论我想要什么类型)的最佳方法是什么?我真的想要这样的东西:

class parentTask(luigi.Task):

    def requires(self):
        return subTask({'file_postfix': 'foo',
                        'file_content': 'bar'
        })

    def run(self):
        return


class subTask(luigi.Task):
    params = luigi.DictParameter()

    def output(self):
        return luigi.LocalTarget("file_{}.csv".format(self.params['file_postfix']))

    def run(self):
        with self.output().open('w') as f:
            f.write(self.params['file_content'])
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,我尝试使用luigi.DictParameter而不是直的,但当我运行上面的命令时,luigi.Parameter我是从路易吉内心深处的某个地方得到的。TypeError: unhashable type: 'dict'

运行Python 2.7.11、Luigi 2.1.1

python luigi

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

JQuery .val()返回html(不是输入字段的值)

鉴于html:

<div id="rearGearInputContainer">
    <input id="rear1"></input>
    <input id="rear2"></input>
    <input id="rear3"></input>
    <input id="rear4"></input>
</div>
Run Code Online (Sandbox Code Playgroud)

在Chrome控制台中,我输入:

$('#rearGearInputContainer').find("input").each(function () {return $(this).val();})
Run Code Online (Sandbox Code Playgroud)

结果是一个html数组:

[<input id=?"rear1">?, <input id=?"rear2">?, <input id=?"rear3">?, <input id=?"rear4">?]
Run Code Online (Sandbox Code Playgroud)

...不是我期望的输入字段值的数组.有谁能解释为什么?谢谢.

html javascript jquery

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

标签 统计

python ×2

api ×1

html ×1

javascript ×1

jquery ×1

luigi ×1

mixpanel ×1

rest ×1