Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
maiios
Frequent Visitor

Python step is changing unrelated columns

I have a column that needs some advanced parsing, that seems to be best done with Python. However, there is another column that I am not touching in Python that is being altered. Can anyone explain what is going on under the hood?

 

 

# 'dataset' holds the input data for this script
import pandas as pd
ds = dataset
ds['ROAD_NAME_CLEAN'] = ds['ROAD_NAME'].str.extract(r'(\d+\s+)?([NnEeSsWw](\.\s|\s|\.))?([^\(]*)(\s?\(.*\))?')[3]
ds['REFERENCE_ROAD_NAME_CLEAN'] = ds['REFERENCE_ROAD_NAME'].str.extract(r'(\d+\s+)?([NnEeSsWw](\.\s|\s|\.))?([^\(]*)(\s?\(.*\))?')[3]
dataset = ds

 

 

Before:

maiios_0-1599665685300.png

After:

maiios_1-1599665760108.png

 

 

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@maiios - Sorry, what is being affected that shouldn't? It's hard to compare the pictures.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Sorry... the CENSUS_TRACT is chaning from a string to a floating point, even though the column is still a string. Basically, the CENSUS_TRACT is supposed to be a six digit number, but the decimal, and dropping the leading zeros causes issues. 

 

I could reformat the string, but I want to understand why its happening.

 

@dm-p  You have any Python skillz??



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors