<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:
Example
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
import numpy as np
d = {'l':  ['left', 'right', 'left', 'right', 'left', 'right'],
     'r': ['right', 'left', 'right', 'left', 'right', 'left'],
     'v': [-1, 1, -1, 1, -1, np.nan]}
df = pd.DataFrame(d)
def g(df):
    return df.groupby('r')['v'].apply(pd.Series.sum,skipna=False)
result = g(df.copy())
<END_TASK>