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

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.

Reply
adamabdell
New Member

Changing Data Type after Python Script

Before I write my python script the 'Period' Column is of type Text but after I apply my script 'Period' becomes of type Date

How to I get it to stop automatically changing the data type? I want to keep it of type Text because then the script doesn't find the conditional statement that I am making.

 

Before:

adamabdell_3-1647360288967.png

 

 

After Script:

adamabdell_2-1647360227030.png

 

 

I've used this same code in Jupyter Notebook and it did exactly what I wanted.

 

 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @adamabdell ;

You could delete it in power query.

First open Formula Bar,

vyalanwumsft_0-1647570556529.jpeg

Then delete the date's type.

vyalanwumsft_1-1647570613537.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @adamabdell ;

You could delete it in power query.

First open Formula Bar,

vyalanwumsft_0-1647570556529.jpeg

Then delete the date's type.

vyalanwumsft_1-1647570613537.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

mh2587
Super User
Super User

Change it by clicking the calendar icon then select the text type 


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



@mh2587  thank you for your response!

I have done that. But the issue is that the script is then not recognizing the change. 

My table has 2 columns. Period and Value.

My script basically says:

if Period = 'a period':

       then Value - 100 

else:

       then Value - 50

 

And with using pandas in the the return values are being stored in a new column

Does that make sense?

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.