[Pandas-dev] Series.value_counts and length of series
Joris Van den Bossche
jorisvandenbossche at gmail.com
Sun Sep 8 16:29:02 EDT 2019
Hi,
That should not happen (the length is normally part of the Series
representation, independent of the data type or the content or length of
the Series). Can you provide a reproducible example? (a piece of code that
is self-contained and we can run to reproduce the issue)
Best,
Joris
On Sun, 8 Sep 2019 at 22:24, Vicki Brown <vlb at cfcl.com> wrote:
> Hi -
>
> I have a dataset:
>
> <class 'pandas.core.frame.DataFrame'>
> RangeIndex: 237061 entries, 0 to 237060
> Data columns (total 23 columns):
> Date 237061 non-null datetime64[ns]
> Station Number 237061 non-null object
> Depth 237061 non-null float64
> ...
>
> For three of the columns, I have calculated value_counts.
> For two of those, the result includes the length of the set; for the
> third, it does not.
>
> Why not?
>
> In [1]: dt = wq_df['Date']
> dt_counts = dt.value_counts()
>
> In [2]: st = wq_df['Station Number']
> st_counts = st.value_counts()
>
> In [3]: dp = wq_df['Depth']
> dp_counts = dp.value_counts()
>
> In [4]: dt_counts
>
> Out[4]: 1969-04-10 21
> ...
> Name: Date, Length: 1172, dtype: int64
>
> In [5]: st_counts
> Out[5]: 18 16622
> ...
> Name: Station Number, dtype: int64
>
> In [6]: dp_counts
> Out[6]: 0.5 1962
> ...
> Name: Depth, Length: 99, dtype: int64
>
>
>
> -- Vicki
>
> Vicki Brown
> cfcl.com/vlb
>
>
>
> _______________________________________________
> Pandas-dev mailing list
> Pandas-dev at python.org
> https://mail.python.org/mailman/listinfo/pandas-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pandas-dev/attachments/20190908/03a4c103/attachment.html>
More information about the Pandas-dev
mailing list