-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone
Description
Code Sample
import pandas as pd
data1={(1, 2): 3,
(4, None): 6}
s1 = pd.Series(data=data1)
data2={(1, 2): 3,
(None, 5): 6}
s2 = pd.Series(data=data2)Problem description
s1 has MultiIndex while s2 has Index of tuple just because the second element of the data2 has None as the first element of the key tuple.
>>> s1
1 2 3.0
4 NaN NaN
dtype: float64
>>> s2
(1, 2) 3
(None, 5) 6
dtype: int64Is this a bug? or is this how it's supposed to be?
FYI, both of mi1 and mi2 below yield MultiIndex as I expect.
mi1 = pd.MultiIndex.from_tuples([(1, 2), (4, None)])
mi2 = pd.MultiIndex.from_tuples([(1, 2), (None, 5)])Metadata
Metadata
Assignees
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate