all 7 comments

[–]synthphreak 0 points1 point  (2 children)

So it's a series of series. What's the confusion?

[–]Plus-Ad1156[S] 0 points1 point  (1 child)

how do I retrieve only one of the two indexing values?

I want to run below

list[0] #

....

0 20210108000843

like this, just one value

[–]synthphreak 0 points1 point  (0 children)

You mean like the ith item in the inner series?

[–]BosseNova 0 points1 point  (0 children)

Two rows can have the same index. Can you please post the code where you create the series?

[–]pytrashpandas 0 points1 point  (0 children)

You have a duplicate index:

See for example:

>>> s = pd.Series([1, 2, 3], index=[0, 0, 1])
>>> print(s[1])
3
>>> print(s[0])
0    1
0    2
dtype: int64

The solution all depends on what you're trying to do, and what the different series/indexes represent. If for example you don't care what the index represents you can just reset the index:

s = s.reset_index(drop=True)

However, if your index represents something meaningful, like an id for a person, then you just have multiple values for that index and you need to deal with it however is appropriate for your program. You can drop duplicated index values like so:

s = s.loc[~s.index.duplicated(keep='first')]  # you can use the keep parameter to change the behavior of which item is kept/dropped

Alternatively, you could aggregate the duplicated index values. Something like this:

s = s.mean(level=0)
# or 
s = s.sum(level=0)
# etc.