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

Option for showing length of series #15962

Closed
Yevgnen opened this issue Apr 10, 2017 · 4 comments · Fixed by #15974
Closed

Option for showing length of series #15962

Yevgnen opened this issue Apr 10, 2017 · 4 comments · Fixed by #15974
Labels
Duplicate Report Duplicate issue or pull request Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@Yevgnen
Copy link

Yevgnen commented Apr 10, 2017

Code Sample, a copy-pastable example if possible

pd.Series(range(10))

Problem description

There is a option display.show_dimensions which allow show the dimension of a DataFrame, while it would be useful if the length of a Series can be set to show when the index is not a range list.

Expected Output

0    0
1    1
2    2
3    3
4    4
5    5
6    6
7    7
8    8
9    9
dtype: int64

[10 elements/items/or something else...]

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.1.final.0 python-bits: 64 OS: Darwin OS-release: 16.5.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: en_US.UTF-8

pandas: 0.19.2
nose: 1.3.7
pip: 9.0.1
setuptools: 34.3.3
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.19.0
statsmodels: 0.8.0
xarray: 0.9.1
IPython: 5.3.0
sphinx: 1.5.3
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: 1.2.0
tables: None
numexpr: 2.6.2
matplotlib: 2.0.0
openpyxl: 2.4.5
xlrd: None
xlwt: None
xlsxwriter: 0.9.6
lxml: 3.7.3
bs4: 4.5.3
html5lib: 0.999999999
httplib2: None
apiclient: None
sqlalchemy: 1.1.7
pymysql: None
psycopg2: None
jinja2: 2.9.5
boto: None
pandas_datareader: 0.3.0.post

@jreback
Copy link
Contributor

jreback commented Apr 10, 2017

thanks duplicate of #7117 . PR's welcome!

@jreback jreback closed this as completed Apr 10, 2017
@jreback jreback added Duplicate Report Duplicate issue or pull request Output-Formatting __repr__ of pandas objects, to_string labels Apr 10, 2017
@jreback jreback added this to the No action milestone Apr 10, 2017
@jorisvandenbossche
Copy link
Member

In the other issue, it is said that this does happen when it is truncated, but you only cannot control it with the show_dimensions option.
However, with the latest release I don't see any Length indication at all:

In [3]: pd.__version__
Out[3]: '0.14.1'

In [4]: s = pd.Series(np.arange(10000))

In [5]: s
Out[5]: 
0      0
1      1
2      2
3      3
4      4
5      5
6      6
7      7
8      8
9      9
10    10
11    11
12    12
13    13
14    14
...
9985    9985
9986    9986
9987    9987
9988    9988
9989    9989
9990    9990
9991    9991
9992    9992
9993    9993
9994    9994
9995    9995
9996    9996
9997    9997
9998    9998
9999    9999
Length: 10000, dtype: int64
In [3]: pd.__version__
Out[3]: '0.19.2'

In [4]: s = pd.Series(np.arange(10000))

In [5]: s
Out[5]: 
0          0
1          1
2          2
3          3
4          4
5          5
6          6
7          7
8          8
9          9
10        10
11        11
12        12
13        13
14        14
15        15
16        16
17        17
18        18
19        19
20        20
21        21
22        22
23        23
24        24
25        25
26        26
27        27
28        28
29        29
        ... 
9970    9970
9971    9971
9972    9972
9973    9973
9974    9974
9975    9975
9976    9976
9977    9977
9978    9978
9979    9979
9980    9980
9981    9981
9982    9982
9983    9983
9984    9984
9985    9985
9986    9986
9987    9987
9988    9988
9989    9989
9990    9990
9991    9991
9992    9992
9993    9993
9994    9994
9995    9995
9996    9996
9997    9997
9998    9998
9999    9999
dtype: int64

Is this a regression?

@jreback
Copy link
Contributor

jreback commented Apr 11, 2017

it has been this way for a long time. Sure it should/could be fixed. IIRC this was broken when show_dimensions was implemented

@jorisvandenbossche
Copy link
Member

Anyway, adding back the length when it is truncated is actually a very easy fix. And at once also did the show_dimensions issue: #15974

@jreback jreback modified the milestones: 0.20.0, No action Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants