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

[BUG] get_data method throws KeyError when using language='en' #88

Closed
bergnerjonas opened this issue Apr 4, 2024 · 3 comments
Closed

Comments

@bergnerjonas
Copy link
Collaborator

bergnerjonas commented Apr 4, 2024

Reproducible Example

from pystatis import Table
table = Table(name='81000-0001') 
table.get_dagetta(language='en') 

Error description

When passing language='en'to the get_data method, the following KeyError is thrown:

KeyError: 'Zeit_Label'

Possible solution

The parsing methods need to be adjusted to handle english column names, like in here:

"""Parse GENESIS table ffcsv format into a more readable format"""
# Extracts time column with name from first element of Zeit_Label column
time = pd.DataFrame({data["Zeit_Label"].iloc[0]: data["Zeit"]})
# Extracts new column names from first values of the Merkmal_Label columns
# and assigns these to the relevant attribute columns (Auspraegung_Label)
attributes = data.filter(like="Auspraegung_Label")
attributes.columns = data.filter(like="Merkmal_Label").iloc[0].tolist()

@bergnerjonas
Copy link
Collaborator Author

I will take a look at fixing this myself

@pmayd
Copy link
Collaborator

pmayd commented Apr 4, 2024

This should already have been done by Pia, she introduced a dictionary for the language and changed the labels, didn't she? I know there was aPR where we discussed the different labels in different languages

@bergnerjonas
Copy link
Collaborator Author

You mean #58, right?
I will close the issue then.

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