我使用R来生成过去6个月的统计报告.我得到了如下所述的要求:
输入数据框架:
FY_Qtr region Lic_type revenue
2009 Q1 AP NCV 126.67
2010 Q1 NA NCV 395.80
2011 Q1 LA NCV 469.10
2012 Q1 EMEA MR 173.85
2013 Q1 JAPAN MR 140.24
Run Code Online (Sandbox Code Playgroud)
预期数据:
FY_Qtr AP.NCV NA.NCV LA.NCV EMEA.MR JAPAN.MR
2009 Q1 126.67 - - - -
2010 Q1 - 395.80 - - -
2011 Q1 - - 469.10 - -
2012 Q1 - - - 173.85 -
2013 Q1 - - - - 140.24
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我获得预期的数据吗?
最近六个月以来,我一直在使用Airlfow。我非常高兴在Airflow中定义工作流程。我在以下情况下无法获得xcom值(以黄色突出显示)。
请在下面的示例代码中找到代码:
def push_function(**context):
context['ti'].xcom_push(key='reportid', value='xyz')
dummy_operator = DummyOperator(
task_id='Start',
dag=main_dag
)
push_function_task = PythonOperator(
task_id='push_function',
provide_context=True,
python_callable=push_function,
op_kwargs={},
dag=main_dag)
push_function_task .set_upstream(dummy_operator)
custom_task = CustomOperator(
dag=main_dag,
task_id='import_data',
provide_context=True,
url="http://www.google.com/{}".format("{{task_instance.xcom_pull(task_ids='push_function')}}")
)
custom_task .set_upstream(push_function_task)
Run Code Online (Sandbox Code Playgroud)
注意:1. CustomOperator是我自己的操作员,负责下载给定URL的数据
请帮我。
谢谢,萨曼斯