Kshirod Mohanty
03/23/2023, 1:39 AMfrom gooddata_sdk import sdk, Attribute
sdk = gooddata_sdk.GoodDataSdk.create(host, token)
items = [
Attribute(local_id="parent_field_P", label="parent.field_P"),
Attribute(local_id="child_field_C", label="child.field_C"),
]
table = sdk.tables.for_items(workspace_id, items=items)
for result in table.read_all():
print(result)
Jan Kadlec
03/23/2023, 7:07 AMfrom gooddata_pandas import *
from gooddata_sdk import Attribute
good_pandas = GoodPandas(host, token)
df_factory = good_pandas.data_frames(workspace_id)
df_factory.for_items({"category":Attribute(local_id="abc", label="campaign_channels.category"), "name": Attribute(local_id="xyz", label="campaign_name" )})
# or you do not need Attribute object at all
df_factory.for_items({"category": "label/campaign_channels.category", "name": "label/campaign_name"})
Both approaches return pandas.DataFrame.
category name
0 Advertising 2015 Bamity 1AZ713
1 Advertising 2015 Bitchip 5FY971
2 Advertising 2015 Fintone 2PG648
3 Advertising 2015 Gembucket 6NG829
4 Advertising 2015 Kanlam 5YM478
.. ... ...
138 Web 2017 It 9XF277
139 Web 2017 Lotstring 4RF728
140 Web 2017 Tempsoft 4AZ168
141 Web 2018 Quo Lux 2CJ961
142 Web 2018 Ronstring 9LY887
Kshirod Mohanty
03/23/2023, 6:15 PMJan Kadlec
03/23/2023, 6:15 PMKshirod Mohanty
03/23/2023, 6:18 PMKshirod Mohanty
03/23/2023, 6:18 PMpip install gooddata-pandas
Jan Kadlec
03/23/2023, 6:22 PMpip install gooddata-pandas
. The following code did not raise any error.
>>> from gooddata_pandas import *
>>> pandas = GoodPandas("<http://localhost:3000>","YWRtaW46Ym9vdHN0cmFwOmFkbWluMTIz")
>>> df_factory = pandas.data_frames("demo")
Jan Kadlec
03/23/2023, 6:28 PMKshirod Mohanty
03/23/2023, 6:45 PMfrom gooddata_pandas import GoodPandas
good_pandas = GoodPandas("host", "token")
Kshirod Mohanty
03/23/2023, 6:45 PMJan Kadlec
03/23/2023, 6:46 PM.venv in ~/Downloads python
>>> from gooddata_pandas import GoodPandas
>>> good_pandas = GoodPandas("host", "token")
>>>
Kshirod Mohanty
03/23/2023, 6:49 PMJan Kadlec
03/23/2023, 6:49 PMgooddata-afm-client 1.3.0
gooddata-api-client 1.3.0
gooddata-metadata-client 1.3.0
gooddata-pandas 1.3.0
gooddata-scan-client 1.3.0
gooddata-sdk 1.3.0
Jan Kadlec
03/23/2023, 6:49 PMKshirod Mohanty
03/23/2023, 9:21 PM[{"category: "Advertising", "name: ["value1", "value2"] , {"category: "Web", "name: ["value3", "value4"] }
Jan Kadlec
03/23/2023, 9:38 PMx.set_index("name").groupby("category").groups
The result is:
{'Advertising': ['2015 Bamity 1AZ713', '2015 Bitchip 5FY971', ...], 'Content': ['2015 Bitchip 5FY971', '2015 Cookley 7NR903', ...], ...}