pandas applymap converts zero-length dataframe to series #13779
Labels
Bug
Duplicate Report
Duplicate issue or pull request
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Much simpler example
The docs for Dataframe.applymap clearly say it will return a DataFrame. However that does not happen if you call it on a DataFrame with no rows -- it returns a series. Not only that, the series has values in it, which is not what anyone would expect from an empty DataFrame.
This is with pandas 0.18.0.
Almost anyone would expect applymap() on an empty DataFrame to return an empty DataFrame, not convert it to a Series with NaNs. We should change it to return an empty DataFrame.
The text was updated successfully, but these errors were encountered: