Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
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 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.