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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
GoingDigital123
Regular Visitor

How to convert 'pandas.core.series.Series' to type 'int' when I use a python script within powerquer

I am using a python script to manipulate data within powerquery. When I pass a table from powerquery with the column data type as 'decimal number' in powerquery, it arrives at python as of class 'pandas.core.series.Series'. If I am not mistaken, all data that passes from powerquery to python actually gets there as 'pandas.core.series.Series', independently of their previous data type.

With that said, I want to convert this column type again to a number of any kind (float, integer...). I tried multiple ways of converting it but it never works and stays as pandas.core.series.Series. For example, I have tried doing:

dataset['start_t'] = pd.to_numeric(dataset['start_t']) # 'start_t' is my column name

raise Exception(type(dataset['start_t'])) # still gives type class 'pandas.core.series.Series'
                                          # I use raise exception because it print doesn't work in powerquery

This doesn't work as well

df['start_t'] = df['start_t'].astype(int)

If I am not able to get the column type as a number I don't think I will be able to manipulate data as I wish. I need to convert those values from Unix to a timestamp and do subtractions, but nothing of that works when I have a 'pandas.core.series.Series'.

I have also tried getting the column from powerquery as a 'text' type but I do still get a 'pandas.core.series.Series'.

How should I deal with this? Has anyone faced this issue?

1 REPLY 1
v-angzheng-msft
Community Support
Community Support

Hi, @GoingDigital123 

 

I can't reproduce your question due to lack of experience with pandas, how did you pass the table to python and get the type above?

 

Here is the thread I found, you can refer to it and check if this is useful to you.

 

Converting pandas.core.series.Series to dataframe with appropriate column values python

How can I turn a pandas.core.series.Series into a Dataframe? [duplicate]

How to convert pandas.core.series.Series object with Multiple index to a pandas Dataframe with all c...

how to assign a pandas.core.series.Series to a pandas dataframe column

How to covert pandas.core.series.Series to string?

 

 

 

Best Regards,
Community Support Team _ Zeon Zheng


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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