<SYSTEM_TASK:>
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
<END_TASK>
<USER_TASK:>
Problem:
I have the following dataframe:
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
df = pd.DataFrame({'key1': ['a', 'a', 'b', 'b', 'a', 'c'],
                   'key2': ['one', 'two', 'one', 'two', 'one', 'two']})
def g(df):
    return df.groupby('key1')['key2'].apply(lambda x: (x=='one').sum()).reset_index(name='count')
result = g(df.copy())
<END_TASK>