We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
I noticed that VersionInfo are rendered badly in Pandas DataFrame. (see scls19fr/arduino_libraries_search#8 )
VersionInfo
They are rendered as tuple.
In [1]: import pandas as pd In [2]: import semver In [3]: versions = ['4.0.0', '5.0.0', '5.0.1', '10.0.0'] In [4]: df = pd.DataFrame(versions, columns=['versions']) In [5]: df # version as string In [6]: df.sort_values(by='versions') # so they are not ordered correctly Out[6]: versions 3 10.0.0 0 4.0.0 1 5.0.0 2 5.0.1 In [7]: df['versions'] = df['versions'].map(semver.parse_version_info) # parse versions as `VersionInfo` In [8]: df.sort_values(by='versions') # VersionInfo are ordered correctly but are badly rendered Out[8]: versions 0 (4, 0, 0, None, None) 1 (5, 0, 0, None, None) 2 (5, 0, 1, None, None) 3 (10, 0, 0, None, None)
I don't know what method Pandas use for rendering them. What I see is that it's neither using __str__ neither using __repr__ method
__str__
__repr__
In [9]: v = df['versions'].iloc[-1] In [10]: v Out[10]: VersionInfo(major=10, minor=0, patch=0, prerelease=None, build=None) In [11]: v.__str__() Out[11]: '10.0.0' In [12]: v.__repr__() Out[12]: 'VersionInfo(major=10, minor=0, patch=0, prerelease=None, build=None)'
VersionInfo inherits from namedtuple so this is probably related.
namedtuple
Any idea?
The text was updated successfully, but these errors were encountered:
Issue opened upstream at pandas-dev/pandas#21208
Sorry, something went wrong.
Remove namedtuple inheritance (#93)
2754b7e
Closes #87 Closes #94 Add entries to CHANGELOG
No branches or pull requests
Hello,
I noticed that
VersionInfo
are rendered badly in Pandas DataFrame.(see scls19fr/arduino_libraries_search#8 )
They are rendered as tuple.
I don't know what method Pandas use for rendering them.
What I see is that it's neither using
__str__
neither using__repr__
methodVersionInfo
inherits fromnamedtuple
so this is probably related.Any idea?
The text was updated successfully, but these errors were encountered: