Skip to content
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

dicts attribute of DictsView conflicts with util.base.dicts() method #643

Open
bmaggard opened this issue Mar 27, 2023 · 0 comments
Open
Labels
Bug It must work in all situations, but this failed

Comments

@bmaggard
Copy link
Contributor

self.dicts = dicts

In [1]: import petl as etl

In [2]: dummy = etl.dummytable()

In [3]: dummy
Out[3]: 
+-----+-----------+---------------------+
| foo | bar       | baz                 |
+=====+===========+=====================+
|  24 | 'apples'  |  0.9829038224380889 |
+-----+-----------+---------------------+
|  44 | 'oranges' | 0.14938272048364054 |
+-----+-----------+---------------------+
|  54 | 'pears'   |  0.7060235672693753 |
+-----+-----------+---------------------+
|  58 | 'pears'   | 0.12677371544592353 |
+-----+-----------+---------------------+
|  17 | 'pears'   |  0.2684826823900752 |
+-----+-----------+---------------------+
...

In [4]: dummy.dicts()
Out[4]: 
{'foo': 24, 'bar': 'apples', 'baz': 0.9829038224380889}
{'foo': 44, 'bar': 'oranges', 'baz': 0.14938272048364054}
{'foo': 54, 'bar': 'pears', 'baz': 0.7060235672693753}
{'foo': 58, 'bar': 'pears', 'baz': 0.12677371544592353}
{'foo': 17, 'bar': 'pears', 'baz': 0.2684826823900752}
...

In [5]: table = etl.fromdicts(dummy.dicts())

In [6]: table
Out[6]: 
+-----+-----------+---------------------+
| foo | bar       | baz                 |
+=====+===========+=====================+
|  24 | 'apples'  |  0.9829038224380889 |
+-----+-----------+---------------------+
|  44 | 'oranges' | 0.14938272048364054 |
+-----+-----------+---------------------+
|  54 | 'pears'   |  0.7060235672693753 |
+-----+-----------+---------------------+
|  58 | 'pears'   | 0.12677371544592353 |
+-----+-----------+---------------------+
|  17 | 'pears'   |  0.2684826823900752 |
+-----+-----------+---------------------+
...

In [7]: table.dicts()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In [7], line 1
----> 1 table.dicts()

TypeError: 'DictsView' object is not callable
@juarezr juarezr added the Bug It must work in all situations, but this failed label Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It must work in all situations, but this failed
Projects
None yet
Development

No branches or pull requests

2 participants