[featureRequest] pd.DataFrame.iterdicts()
See original GitHub issueCode
Can we have a method that returns an iterator of dictionary instead of tuples? Something like
def iterdicts(self, **kwargs):
it = (x.__dict__ for x in self.itertuples())
return it
Output of pd.show_versions()
[paste the output of pd.show_versions()
here below this line]
INSTALLED VERSIONS
commit: None python: 2.7.12.final.0 python-bits: 64 OS: Linux OS-release: 4.4.0-143-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: None.None
pandas: 0.24.2 pytest: 3.2.3 pip: 19.0.3 setuptools: 40.8.0 Cython: 0.25.2 numpy: 1.14.0 scipy: 1.0.0 pyarrow: None xarray: None IPython: 5.7.0 sphinx: 1.7.4 patsy: 0.5.1 dateutil: 2.7.3 pytz: 2018.4 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: 2.2.3 openpyxl: None xlrd: 1.2.0 xlwt: 1.3.0 xlsxwriter: 1.1.5 lxml.etree: 3.5.0 bs4: None html5lib: 1.0.1 sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None gcsfs: None
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (7 by maintainers)
I did a bit of benchmarking. The result is in favour for an extension of iterrows()
Update: I added my proposed implementation of iterdict() as well. I hope we would agree that adding a such method make the code much simpler.
results
yep the corner cases make this a -1