It seems like you're trying to use the groupby
function from pandas and then get the length of each group. However, len()
is not a valid function to use with groupby
. You might want to use size()
or count()
instead. Here's how you can do it:
df_1.groupby('文件名').size()
or
df_1.groupby('文件名').count()
These will return the number of rows in each group. If you want to count non-NA cells for each column or row, you should use count()
. If you simply want to know the number of items in each group, you should use size()
.