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.
When ever I make an API call I am getting below sample data. Due to API call limitations ican only return 5000 recors at a time. if I have 50000 records I have to make 10 calls with 5000 records in each call.
Now I want to combine all these records into a single dictionary and then export into a csv file.
Code I have tried and failed, since the below codes are updating records in one of the dictionaries if the value exist
pd1 = pd.DataFrame(data)
pd2 = pd.DataFrame(data_1)
print(pd1.append(pd2))
def Merge(dict1, dict2):
res = {**dict1, **dict2}
return res
# Sample 2
dict1 = {'a': 10, 'b': 8}
dict2 = {'d': 6, 'c': 4}
dict3 = Merge(dict1, dict2)
print(dict3)
Sample Data:
*{'@odata.context': 'http://wabi-us-north-central-f-primary-redirect.analysis.windows.net/v1.0/myorg/admin/$metadata#grou...', '@odata.count': 2754, 'value': [{'id': 'ABCDEF-EC21-ABCDFEG-A6F9-fsdafsadf', 'isReadOnly': False, 'isOnDedicatedCapacity': True, 'capacityId': 'sdfasdfasd-F3A6-gfda-dsafas-asdfasd', 'capacityMigrationStatus': 'Migrated', 'type': 'Workspace', 'state': 'Active', 'name': 'DSS Dev Workspace', 'datasets': [{'id': 'sdfas-3436-fasdfas-a377-dsfa', 'name': 'Net Revenue Reporting v2', 'addRowsAPIEnabled': False, 'configuredBy': 'asdf.fdsa@asdfgasdf.com', 'isRefreshable': True, 'isEffectiveIdentityRequired': False, 'isEffectiveIdentityRolesRequired': False, 'targetStorageMode': 'Abf', 'createdDate': '2019-09-18T20:05:21.887Z', 'contentProviderType': 'PbixInImportMode', 'upstreamDatasets': [], 'schemaMayNotBeUpToDate': False, 'users': []}, {'id': 'e102e519-8fa1-4e2f-95b4-d6e0fa85960a', 'name': 'Month Stats Review (1)', 'addRowsAPIEnabled': False, 'configuredBy': 'fasd.fasd@afdsasd.com', 'isRefreshable': True, 'isEffectiveIdentityRequired': False, 'isEffectiveIdentityRolesRequired': False, 'targetStorageMode': 'Abf', 'createdDate': '2020-02-28T21:27:09.147Z', 'contentProviderType': 'PbixInImportMode', 'upstreamDatasets': [], 'schemaMayNotBeUpToDate': False, 'users': []}]}]}*
Hi Guys
I eneded up going one level down (value property) where the data is stored in list format. I have appended all data to a list and exported to txt file. As shown below.
'value': [{'id': 'ABCDEF-EC21-ABCDFEG-A6F9-fsdafsadf', 'isReadOnly': False, 'isOnDedicatedCapacity': True, 'capacityId': 'sdfasdfasd-F3A6-gfda-dsafas-asdfasd', 'capacityMigrationStatus': 'Migrated', 'type': 'Workspace', 'state': 'Active', 'name': 'DSS Dev Workspace', 'datasets': [{'id': 'sdfas-3436-fasdfas-a377-dsfa', 'name': 'Net Revenue Reporting v2', 'addRowsAPIEnabled': False, 'configuredBy': 'asdf.fdsa@asdfgasdf.com', 'isRefreshable': True, 'isEffectiveIdentityRequired': False, 'isEffectiveIdentityRolesRequired': False, 'targetStorageMode': 'Abf', 'createdDate': '2019-09-18T20:05:21.887Z', 'contentProviderType': 'PbixInImportMode', 'upstreamDatasets': [], 'schemaMayNotBeUpToDate': False, 'users': []}, {'id': 'e102e519-8fa1-4e2f-95b4-d6e0fa85960a', 'name': 'Month Stats Review (1)', 'addRowsAPIEnabled': False, 'configuredBy': 'fasd.fasd@afdsasd.com', 'isRefreshable': True, 'isEffectiveIdentityRequired': False, 'isEffectiveIdentityRolesRequired': False, 'targetStorageMode': 'Abf', 'createdDate': '2020-02-28T21:27:09.147Z', 'contentProviderType': 'PbixInImportMode', 'upstreamDatasets': [], 'schemaMayNotBeUpToDate': False, 'users': []}]}]
Hi @Anonymous
I found some blogs, I hope they can help you.
Use Python in Power Query Editor
How to use Python/R to analyze a joined table in Power BI?
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
5 | |
4 | |
3 | |
2 | |
2 |
User | Count |
---|---|
8 | |
6 | |
4 | |
4 | |
4 |