Pandas Series.ne operator returning unexpected result against two slices of same Series #19855
Labels
Indexing
Related to indexing on series/frames, not to indexes themselves
Numeric Operations
Arithmetic, Comparison, and Logical operations
Usage Question
So I have this series of integers shown below
And I want to see how many times the numbers changes over the series, so I compare two slices of the same string to one another.
Not only does the output using the
Series.ne
method not make any logical sense to me but the output is also longer than either of the inputs which is especially confusing.I think this might be related to this #1134
Apologies if this isn't an issue but I haven't been able to find any satisfactory explanation for this behavior
tl;dr:
Where
s
is a pandas.Series of int's[i != s[:-1][idx] for idx, i in enumerate(s[1:])] != s[:-1].ne(s[1:]).tolist()
The text was updated successfully, but these errors were encountered: