Skip to content

generalize stack to more than 1 dimension #56

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

Closed
gdementen opened this issue Jan 24, 2017 · 1 comment
Closed

generalize stack to more than 1 dimension #56

gdementen opened this issue Jan 24, 2017 · 1 comment
Milestone

Comments

@gdementen
Copy link
Contributor

Here are a few syntax experiments (but see also #30):

# 2D
stack([(('BE', 'M'), 1.0), (('BE', 'F'), 0.0),
       (('FO', 'M'), 1.0), (('FO', 'F'), 0.0)], ('nat', 'sex'))

# 3D
# a) flat list, label tuple
stack([(('BE', 1, 'M'), 1.0), (('BE', 1, 'F'), 0.0),
       (('BE', 2, 'M'), 1.0), (('BE', 2, 'F'), 0.0),
       (('BE', 3, 'M'), 1.0), (('BE', 3, 'F'), 0.0),
       (('FO', 1, 'M'), 1.0), (('FO', 1, 'F'), 0.0),
       (('FO', 2, 'M'), 1.0), (('FO', 2, 'F'), 0.0),
       (('FO', 3, 'M'), 1.0), (('FO', 3, 'F'), 0.0)],
      ('nat', 'type', 'sex'))

# b) recursive structure
stack([('BE', [(1, [('M', 1.0), ('F', 0.0)]),
               (2, [('M', 1.0), ('F', 0.0)]),
               (3, [('M', 1.0), ('F', 0.0)])]),
       ('FO', [(1, [('M', 1.0), ('F', 0.0)]),
               (2, [('M', 1.0), ('F', 0.0)]),
               (3, [('M', 1.0), ('F', 0.0)])])],
       ('nat', 'type', 'sex'))
@gdementen
Copy link
Contributor Author

see also #455

@alixdamman alixdamman added this to the 0.32 milestone Jul 20, 2018
gdementen added a commit that referenced this issue Jun 20, 2019
* generalized it to more than one dimension (closes #56)

  - works for both stack([(ndkey, value), ...], axis=axes) and stack({ndkey: value}, several_axes)
  - deprecated axis argument in favor of axes

* changed the exception when using **kwargs without an axis on Python < 3.6 to a warning

* allowed using a dict without axis (closes #581, closes #755)

  This will produces a warning on Python < 3.7

* added support for res_axes
@gdementen gdementen modified the milestones: 0.32, 0.30 Jun 20, 2019
gdementen added a commit that referenced this issue Jun 26, 2019
* generalized it to more than one dimension (closes #56)

  - works for both stack([(ndkey, value), ...], axis=axes) and stack({ndkey: value}, several_axes)
  - deprecated axis argument in favor of axes

* changed the exception when using **kwargs without an axis on Python < 3.6 to a warning

* allowed using a dict without axis (closes #581, closes #755)

  This will produces a warning on Python < 3.7

* added support for res_axes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants