简体   繁体   English

Python 脚本填充 Power Bi 上的特定列

[英]Python Script to fill specific column on Power Bi

Is there a way on Power Bi to populate a specific column with values using a Python Script ? Power Bi 有没有办法使用 Python 脚本填充特定列的值? For example, I want to calculate the number of days between the start date and end date in this table:例如,我想计算此表中开始日期和结束日期之间的天数:

幂比表 . .

  1. Go to 'Edit Queries` Go 到“编辑查询”
  2. A dialog box with your table will open, then click Run Python Script将打开一个包含您的表格的对话框,然后单击Run Python Script
  3. Enter the below code and press OK输入以下代码,然后按OK

Code:代码:

import pandas as pd

df['Remaining Days'] = pd.to_datetime( df['Contract End Date']) - pd.to_datetime(df['Contract Start Date'])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM