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

to_hierarchical_dataframe() DataFrames are too wide and long #23

Open
lvsltz opened this issue Nov 29, 2019 · 3 comments
Open

to_hierarchical_dataframe() DataFrames are too wide and long #23

lvsltz opened this issue Nov 29, 2019 · 3 comments
Milestone

Comments

@lvsltz
Copy link
Collaborator

lvsltz commented Nov 29, 2019

Not sure if in your control but I mention this anyway.
to_hierarchical_dataframe() and to_denormalized_dataframe() generate very wide and long DataFrames. To save some space and facilitate visualization, the stimulus, response and electrode columns from intracellular_recordings should contain fewer details.

image

@oruebel
Copy link
Owner

oruebel commented Nov 29, 2019

@lvsltz that makes sense. I think the proper solution would be to wrap the stimulus and response columns in a separate class (and to give them a new neurodata_type) so that we can control the representation. That is certainly possible but requires a bit of coding and changes to schema, i.e., it may take a bit before I can get to this issue.

@oruebel oruebel added this to the Future milestone Feb 7, 2020
@oruebel
Copy link
Owner

oruebel commented Mar 6, 2020

A simple workaround would be to set the maximum width for columns in the pandas display, e.g.,:

import pandas
pandas.set_option("display.max_colwidth", 30)

This allows you to control the column width in the rendering. However, it would still be nice to have nicer text representations for the stimulus and response columns.

@lvsltz
Copy link
Collaborator Author

lvsltz commented Mar 6, 2020

Yes, this can work too. What I was thinking of is more to decorate python's display() or hdmf's Container when a denormalized_dataframe is shown, like below:

from pynwb.icephys import PatchClampSeries, IntracellularElectrode

def newrepr(self):
    cls = self.__class__
    if cls.__name__ in ['VoltageClampStimulusSeries',
                        'VoltageClampSeries',
                        'CurrentClampStimulusSeries',
                        'CurrentClampSeries',
                        'IntracellularElectrode']:
        template = "%s" % (self.name)
    else:
        template = self.__repr__()
    return template

IntracellularElectrode.__repr__ = newrepr
PatchClampSeries.__repr__ = newrepr

image

But this issue is really not very important, you can even close it :)

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

2 participants