You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpandasaspddata= {}
columns= ['symbol', 'price']
df=pd.DataFrame(data, columns=columns)
df.symbol=='AAPL'# TypeError: Could not compare <type 'str'> type with Series
The problem being that an empty dataframe's dtype defaults to float. I've adjusted for it by checking the len of data and setting the dtype to object when at 0. But I feel like an empty DataFrame should act like an empty list, valid for all list operations. Which in lieu of #549, means casting the widest net possible with dtype=object.
The text was updated successfully, but these errors were encountered:
Taking a look at this. I'm amazed (disturbed, a little?) so far how little code I'm having to touch (and how few tests are breaking as a result) to make this change
I ran into the following :
The problem being that an empty dataframe's dtype defaults to float. I've adjusted for it by checking the len of data and setting the dtype to object when at 0. But I feel like an empty DataFrame should act like an empty list, valid for all list operations. Which in lieu of #549, means casting the widest net possible with dtype=object.
The text was updated successfully, but these errors were encountered: