Skip to content

Adding encoding specification parameter when opening yaml file #86

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kirill237
Copy link

Adding the ability to specify in which encoding the file should be opened to generate a table from yaml

Adding the ability to specify in which encoding the file should be opened to generate a table from yaml
@timvink
Copy link
Owner

timvink commented Aug 6, 2025

Hee, thanks for the PR!

This could be an interesting addition. We should also add it to read_raw(). And document it (in docs/).

There's still a unit test to check though.

Comment on lines +137 to +139
if "encoding" in kwargs:
defaultEncoding = kwargs["encoding"]
del kwargs["encoding"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this below the json_kwargs line. If pd.json_normalize() ever adds an encoding parameter, we would still be able to processs it.

Even better would be to just use: with open(args[0], "r", encoding=kwargs.get("encoding","UTF-8") as f:

Comment on lines +147 to +150
defaultEncoding = "UTF-8"
if "encoding" in kwargs:
defaultEncoding = kwargs["encoding"]
del kwargs["encoding"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, just use encoding=kwargs.get("encoding","UTF-8") directly.

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

Successfully merging this pull request may close these issues.

2 participants