Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please can you help me? / geo_search #9

Closed
jp-geoAI opened this issue Mar 25, 2022 · 3 comments
Closed

Please can you help me? / geo_search #9

jp-geoAI opened this issue Mar 25, 2022 · 3 comments

Comments

@jp-geoAI
Copy link

I'm trying to create a dataframe with Pandas, with the results of a search of

geo_search

But I get this error:

ValueError: DataFrame constructor not properly called!

The code I am using: (https://github.com/Cyclododecene/newsfeed)

from newsfeed.news.apis.filters import *

from newsfeed.news.apis.query import *

f = Art_Filter(

keyword = ["Drugs", "Cocaine", "Police"],

start_date = "2022-01-01-00-00-00",

end_date = "2022-03-01-00-00-00",

country = ["Brazil", "BR"]

)

geo_7d = geo_search(query_filter = f, sourcelang="portuguese", timespan=7)

import pandas as pd

df=pd.DataFrame(geo_7d)

df.head()

Thanks!

@jp-geoAI jp-geoAI changed the title Please could you help me? / geo_search Please can you help me? / geo_search Mar 25, 2022
@TerenceLiu98
Copy link
Contributor

Hi, @jp-geoAI

The output of geo_7d = geo_search(query_filter = f, sourcelang="portuguese", timespan=7) is str thus, you may not load the string into the pd.DataFrame. We are trying to reconstruct this function, as we have mentioned in Issue #8.

The temporary solution is loading it with json

import json
import pandas as pd
geo_7d_json = json.loads(geo_7d)
pd.DataFrame(geo_7d_json)

@jp-geoAI
Copy link
Author

thank you very much! @TerenceLiu98

@TerenceLiu98
Copy link
Contributor

ur welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants