CorrelAid / datenguide-python

MIT License
34 stars 7 forks source link

.results method does not return all regionss on second call #109

Open ghost opened 4 years ago

ghost commented 4 years ago

Description

When creating a query object with the .region factor method and more than one region, the .results method does not return data for all regions on its second call and subsequent calls. It seems to be the case the the .results calls past the first only return results for the last region.

What I Did

from datenguidepy import Query

q = Query.region(['11', '09'])
stat = q.add_field('BEVSTD')
stat.add_args({'year': 1995})
first_call = q.results()
second_call = q.results()
print(first_call.shape[0],first_call.name.unique()) # 2 results, containing 'Berlin' and 'Bayern'
print(second_call.shape[0],second_call.name.unique()) # 1 result, only containing 'Bayern'
EvgenyGorelov commented 3 years ago

Solution: query_builder.py line 157 actually does not copy the object:

this_query_args = field.args

should be

this_query_args = field.args.copy()