
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 <ricky@teachey.org> wrote:
On Fri, Jul 31, 2020, 2:48 AM Wes Turner <wes.turner@gmail.com> wrote:
# Dicts and DataFrames - Src: https://github.com/westurner/pythondictsanddataframes/blob/master/dicts_and_... - Binder: https://mybinder.org/v2/gh/westurner/pythondictsanddataframes/master?filepat... - (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:
Dict[str, float]
Or:
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 -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/C7HJFK... Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido (mobile)