I don't get this. If I create a Series this way, with "tableur" being a DataFrame created from reading an excel file:
pd.Series(data=tableur["Info"].iloc[:,1])
I get what I expect, which is a panda Series with auto-numbered indexes and my mixte values as Dtypes:
That same tableur now also has a columns that I want to use as labels for the indexes of that time series. Thus when I do:
pd.Series(data=tableur["Info"].iloc[:,1], index=tableur["Info"].iloc[:,0])
I'd expect the same series, except well the indexes should be what I provided. However turns out the Serie's values are all Nan:
Specifying dtype="object" in the constructor doesn't help. Both columns are the same length. What am I missing here? Expected results would be something like this:
Where the 1st col is the indexes.
Ah, okay, I can fix it (but still don't understand it).
Calling .tolist() on the DataFrame slices I'm using as inputs for the Series solves the issue. I'd be pretty happy to understand why that being said, and would accept that answer. Why would that work with just data=....
being specified, but not both data=...
& index=..
?