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

GO-ness mismatch could be handled better #8

Open
chaburkland opened this issue Jun 5, 2023 · 0 comments
Open

GO-ness mismatch could be handled better #8

chaburkland opened this issue Jun 5, 2023 · 0 comments

Comments

@chaburkland
Copy link

import frame_fixtures as ff

ff.parse("f(Fg)|s(4, 4)|c(I, str)")                                                                                                                                                                                                                            
---------------------------------------------------------------------------
ErrorInitFrame                            Traceback (most recent call last)
<ipython-input-1-525dac2ecbdb> in <module>
----> 1 ff.parse("f(Fg)|s(4, 4)|c(I, str)")

~/.env38/lib/python3.8/site-packages/frame_fixtures/core.py in parse(dsl)
    730     Given a FrameFixtures DSL string, return a Fraem.
    731     '''
--> 732     return Fixture.parse(dsl=dsl)
    733 
    734 

~/.env38/lib/python3.8/site-packages/frame_fixtures/core.py in parse(cls, dsl, module_sf)
    715             builder = str_to_type['F']
    716 
--> 717         return builder(tb, #type: ignore
    718                 index=index,
    719                 columns=columns,

~/.env38/lib/python3.8/site-packages/static_frame/core/frame.py in __init__(self, data, index, columns, name, index_constructor, columns_constructor, own_data, own_index, own_columns)
   3318         # check after creation, as we cannot determine from the constructor (it might be a method on a class)
   3319         if self._COLUMNS_CONSTRUCTOR.STATIC != self._columns.STATIC:
-> 3320             raise ErrorInitFrame(f'Supplied `columns_constructor` does not match required static attribute: {self._COLUMNS_CONSTRUCTOR.STATIC}')
   3321 
   3322         #-----------------------------------------------------------------------

ErrorInitFrame: Supplied `columns_constructor` does not match required static attribute: False

This is fixed by changing the type of columns to IndexGO, like so:

ff.parse("f(Fg)|s(4, 4)|c(Ig, str)")

I feel the error message for this could be more helpful/clear. Something like:

`FrameFixtureSyntaxError: object type is `FrameGO`, but columns are specified as `Index`. Either change f(Fg) -> f(F), or c(I) -> c(Ig)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant