The input contains NaN, infinity or a value too large for dtype('float64')' when trying to perform a group by operation on my DataFrame. Here's my code snippet:

import pandas as pd

# Load data from CSV
data = pd.read_csv('data.csv')

# Perform groupby operation
grouped = data.groupby('category')['value'].sum()

I've checked for NaN or infinity values in 'value' column using data['value'].isnull().sum() and data['value'].isinf().sum() which both returned 0. What could be causing this error and how can I resolve it?

(Replaced back-ticks with this forum's [code]...[/code] tags ~ MOD)

    Uh, this is a PHP forum; you're wanting a Python one.

      Write a Reply...