Cyclododecene/newsfeed

Please can you help me? / geo_search

Closed this issue · 3 comments

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!

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)

thank you very much! @TerenceLiu98

ur welcome :)