So maybe we need to add dict.ordered() which returns a view on the items that is a Sequence rather than a set? Or ordereditems(), orderedkeys() and orderedvalues()?
On Fri, Jul 31, 2020 at 05:29 Ricky Teachey firstname.lastname@example.org wrote:
On Fri, Jul 31, 2020, 2:48 AM Wes Turner email@example.com wrote:
# Dicts and DataFrames
- (interactive Jupyter Notebook hosted by https://mybinder.org/ )
The punchline of Wes Turner's notebook (very well put together, thank you!) seems to partly be that if you find yourself wanting to work with the position of items in a dict, you might want to consider using a pandas.Series (with it's .iloc method).
A difficulty that immediately came to mind with this advice is type hinting support. I was just googling yesterday for "how to type hint using pandas" and the only thing I found is to use pd.Series and pd.DataFrame directly.
But those don't support type hinting comparable to:
class Vector(TypedDict): i: float j: float
This is a big downside of the advice "just use pandas". Although I love using pandas and use it all the time.
Python-ideas mailing list -- firstname.lastname@example.org To unsubscribe send an email to email@example.com https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://firstname.lastname@example.org/message/C7HJFK... Code of Conduct: http://python.org/psf/codeofconduct/