Panda Set Values and Group-By

#
# Filter Hours < 0 to be 0
# Get the sum of the Hours per Country
#

import pandas as pd
Line1 = {"Country": "USA", "Date":"01 jan", "Hours":4}
Line2 = {"Country": "USA", "Date":"01 jan", "Hours":3}
Line3 = {"Country": "USA", "Date":"01 jan", "Hours":-999}
Line4 = {"Country": "Japan", "Date":"01 jan", "Hours":3}
df=pd.DataFrame([Line1,Line2,Line3,Line4])
df
#Set a value using a index....
#
# df['Hours' ]< 0 gives an Index & True/False - a "mask"
# so....
# dataframe.FIELD [ "mask" ] = Value
df.Hours[ df['Hours' ]< 0 ] =0

#Show what the data frame now looks like
df
Country Date Hours
0 USA 01 jan 4
1 USA 01 jan 3
2 USA 01 jan 0
3 Japan 01 jan 3

4 rows × 3 columns

#
# Now group by
hr=df.groupby(['Country','Date']).Hours.sum()
hr.head()
Country  Date
Japan    01 jan    3
USA      01 jan    7
Name: Hours, dtype: int64

I hope this gave you some idea of how you can progress with Pandas.