Panda dataframe created from search result missing values in privateUrl field!?

496
1
07-30-2020 08:46 AM
LaszloCsunderlik1
New Contributor III

The gis.content.search gives back a list about the given query. After I create from this search result variable a panda dataframe, it gives me the option to access a lot of information about the given services. I would like to call these services with a 3rd party application based on the dataframe privateUrl field. But this field just populates the latest service and for the others the value is NaN. 

Someone facing with this problem?

pandas dataframe‌ 

0 Kudos
1 Reply
by Anonymous User
Not applicable

Hi @LaszloCsunderlik1 , 

 

I believe I am experiencing the same problem, but missing values like size, and who knows what else. I have performed steps following this doco: https://developers.arcgis.com/python/samples/inventory-organizational-content/\

 

# Connect to GIS and import modules
from arcgis.gis import GIS
gis = GIS("home", verify_cert=False)
import arcgis
import datetime as dt
import pandas as pd
from IPython.display import display
import time
import csv
import os


org_users = gis.users.search()
print(f'{len(org_users)} users found')
org_users[:3]

org_content = []

for user in org_users:
    qe = f"owner: {user.username}"
    user_content = gis.content.advanced_search(query=qe, max_items=-1)['results']
    org_content += user_content
    
print(f"{len(org_content)} items found in org")

content_df = pd.DataFrame(org_content)
content_df.head()

 

Result: see attached image. 

Observation: it only writes values for all fields on the first row - whatever is at the top of the list/dict that's written(?) into the data frame (I changed the order to test this)

Observation2: is this a glitch with the python version? I think the info to provide on this is as follows: 
I'm using py3 and pandas 1.2.3 

 

I'm going around this problem by auditing portal content with dictionaries, but would like to know what happened here. 

 

-Nina

 

0 Kudos