Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I have a Power BI report built from a dataflow (that I don't have admin access to). Within Power Query, I have applied a script to one of the tables from this flow. I have then published it to Power BI Service.
I am getting the below error:
As such, I suspect the issue is related to my Python script. I have a couple of questions:
1) Why can I not refresh the report in Power BI Service with this script?
2) Are there any workarounds I could use to avoid this?
I'll leave the Python script below in case anybody has any insights. The script works perfectly when executed in Power Query.
Thank you in advance for the help!
import pandas as pd
import re
from datetime import datetime
def extract_and_standardize_date(text):
if pd.isna(text) or text.strip() == '':
return None
date_pattern = r'\b(0?[1-9]|[12][0-9]|3[01])[-/. ](0?[1-9]|1[012]|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(?:[-/. ](\d{2}|\d{4}))?\b'
match = re.search(date_pattern, text, re.IGNORECASE)
if match:
groups = match.groups()
day = groups[0]
month = groups[1]
year = groups[2] if groups[2] else str(datetime.now().year) # Use current year if year is missing
if month.isalpha():
datetime_object = datetime.strptime(month, "%b")
month = datetime_object.month
if len(year) == 2:
year = '20' + year
return f"{day.zfill(2)}/{str(month).zfill(2)}/{year}"
return None
dataset['standardized_date'] = dataset['Column_X'].apply(extract_and_standardize_date)
dataset
Thanks for the response.
I don't seem to have the ability to create a personal gateway.
Could this be a result of the fact I'm using a dataflow?
You need to do things the other way round. First install and run the personal gateway and then use it in a dataflow.
Python and R scripts and visuals mandate the use of a personal gateway.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
25 | |
3 | |
2 | |
2 | |
2 |