Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a simple test script as follows:
import pandas as pd
dataframe_info = pd.DataFrame(dataset.dtypes)
dataframe_copy = pd.DataFrame(dataset)
dataframe_obj = pd.DataFrame(dataset.loc[:,"Object_Value"])
I'm finding that my table (data source table from SQL Server) which contains a variety of column types, including string, integer, real, and binary, when placed into the "dataset" dataframe, converts the column types to all strings. I know that we can check a box to infer data types, but that doesn't work for my binary fields which all get converted to the string "System.Byte()".
dataframe_info shows all the correct column types, but dataframe.copy has converted all the columns to strings.
Why are the native types in the source table not reserved in the dataframe "dataset"? When I use Python odbc to read the same table into a dataframe, all the types are preserved, including binary.
Thanks in advance.
When importing with Power BI, it would reserve the original type.
As searched, it is said pd.dataframe can't read binary file correctly.
We need to find some python functions to deal with the binary type data.
As a tempory workaround, you could convert the binary type firstly in Power BI, then use python scripts.
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Maggie:
I don't know how to attach images to a post without uploading to a URL, so I'll have to describe what I'm seeing.
I don't expect PQ to decypher my binary contents (that's why I'm writing the Python code).
Thanks,
Chris
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
12 | |
11 | |
9 | |
6 | |
6 |