Fix summarize for old pandas versions