Open NikosGour opened 11 months ago
While I'm no expert, this may be because when you pass a Series (Serieses?) within a list, the DataFrame is trying to parse the dtype for every Series, under the assumption that every value in the list is a Series. When it tries to access the dtype value for the dictionary (which doesn't exist), it returns an AttributeError.
Yeah , i suspect the same , but still if you read the weird observation
part , the opposite, for some weird reason ,works.
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Description
This bug occurs if the Dataframe is initialized by passing an array with objects and the first item MUST be a
Series
object as shown in the example above.Weird Observation
If we flip the order of the object in the array so that the
dict
object is first then the expected behaviour occurs , where the dataframe is created successfully with both object inside. example code and output:output :
Expected Behavior
Expected behaviour
a Dataframe with both objects (that have the same fields) is created
Actual
the program crashes with following stack trace:
Installed Versions