Skip to content

ENH: follow up on indx-repr #10095

Closed
Closed
@jreback

Description

@jreback

follow up to #9901

  • also splitting the attributes part over multiple lines if this is very long
  • for truncated output: now hard-code at 10 elements, but this could maybe also be 1 line? (and possibly with a minimum number of elements for longer strings) Because now, small integers don't fill the full line with 10 elements, and eg floats there is one element on the second line:

This is a function of the display.width. But the truncated output should restrict to a single-line if this happens.

In [6]: pd.set_option('display.width',100)

In [7]: Index(np.arange(400.))
Out[7]: 
Float64Index([  0.0,   1.0,   2.0,   3.0,   4.0,   5.0,   6.0,   7.0,   8.0,   9.0, 
              ...
              390.0, 391.0, 392.0, 393.0, 394.0, 395.0, 396.0, 397.0, 398.0, 399.0],
             dtype='float64', length=400)

In [8]: pd.set_option('display.width',80)

In [9]: Index(np.arange(400.))
Out[9]: 
Float64Index([  0.0,   1.0,   2.0,   3.0,   4.0,   5.0,   6.0,   7.0,   8.0,
                9.0, 
              ...
              390.0, 391.0, 392.0, 393.0, 394.0, 395.0, 396.0, 397.0, 398.0,
              399.0],
             dtype='float64', length=400)

This could eg easily be restricted to two times one line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closing CandidateMay be closeable, needs more eyeballsEnhancementIndexRelated to the Index class or subclassesOutput-Formatting__repr__ of pandas objects, to_string

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions