Skip to content

Output Transformer's auto join of multiple statistics not working if one statistic is empty. #85

Open
@KonradUdoHannes

Description

@KonradUdoHannes
  • Datenguide Python version: 0.2.1
  • Python version: All
  • Operating System: All

Description

The datenguide package provides the possibility to query several statistics at once. When the result is converted to a dataframe the obtained results are automatically joined (outer join). This currently causes an error when one of the statistics is empty. In the spirit of the outer join it and for increased usability a solution that adds all NA columns for that statistic in the result would be preferable.

This was never implemented before, but since it causes an internal error it is considered a bug as well. One could explicitly check for this case and purposefully raise a NotImplemented Error in which case, the issue would stop being a bug while still being a useful enhancement.

What I Did

from datenguidepy.query_builder import Query
q_stat1 = Query.region('01')
q_stat1.add_field('BEVSTD')
print(q_stat1.results().iloc[:,:4].head()) #not empty

q_stat2 = Query.region('01')
q_stat2.add_field('TIE003')
print(q_stat2.results().iloc[:,:4].head()) #empty

q_stat3 = Query.region('01')
q_stat3.add_field('WAHL09')
print(q_stat3.results().iloc[:,:4].head()) #not empty

q_comb13 = Query.region('01')
q_comb13.add_field('BEVSTD')
q_comb13.add_field('WAHL09')
print(q_comb13.results().iloc[:,:5].head()) # Example of the intended autojoin functionality

q_comb12 = Query.region('01')
q_comb12.add_field('BEVSTD')
q_comb12.add_field('TIE003')
print(q_comb12.results().iloc[:,:5].head()) # causes error

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions