Forum Discussion
MongoDB Data is not showing in powerbi by using python script
- 3 years ago
This seemed to work:
# Specify the collection name
collection = db['your_collection_name']
# Perform the query
query = {} # Your query conditions here
result = collection.find(query)
# Convert the query result to a DataFrame
df = pd.DataFrame(result)
# Print the DataFrame
print(df)
Hey sharath123 ,
make sure that the result that you want to use inside PowerBI is a dataframe, I assume you can "convert" your JSON object using Pandas.
Hopefully, this provides what you are looking for.
Regards,
Tom
- sharath1234 years agoHelper I
TomMartens thanks. but how to convert this result into a data frame?
please provide the syntax to convert the result into a data frame, so that I run the script in powerbi.- loch453 years agoNew Member
This seemed to work:
# Specify the collection name
collection = db['your_collection_name']
# Perform the query
query = {} # Your query conditions here
result = collection.find(query)
# Convert the query result to a DataFrame
df = pd.DataFrame(result)
# Print the DataFrame
print(df)