Q:

Is there a way to count the number of days a columns value took to go from A to B for each month?

I have a dataframe with node, value, and datetime columns. I'd like to get the max count of days it took the value to go from 60 to 70 for each month for each node. If the value stayed below 60 or above 70 the value should just be 0. If the value didn't go from 60 to at or above 70 it should be 0.
df:
rng = pd.date_range('2019-01-01', periods=365, freq='D')
df= pd.DataFrame({'Date': rng, 'Val': np.random.randint(50, 80, size=365), 'Node': 'A'}) 
df.set_index('Date', inplace=True)

I've set the index to the node, month, and day, but I can't figure out how to get the count of values between the threshold.
df.set_index(['Node', df.index.month, df.index])['Val'].between(60, 70)

I think the answer should just be the max number of consecutive True values in the 'Val' column after the between has been applied for each month.
The output should be a dataframe like this:
df = pd.DataFrame([
    {'Node': 'A', 'Month': 1, 'Count': 3},
    {'Node': 'A', 'Month': 2, 'Count': 5},
    {'Node': 'A', 'Month': 3, 'Count': 0},
    {'Node': 'B', 'Month': 1, 'Count': 5},
    {'Node': 'B', 'Month': 2, 'Count': 3},
    {'Node': 'B', 'Month': 3, 'Count': 2},
    ...
])

A:

If I understand correctly, 
one idea is to use groupby with a condtional cumsum & cumcount to count consecutive days until 70 is reached.
np.random.seed(0)
np.random.randint(50, 80, size=365)
rng = pd.date_range('2019-01-01', periods=365, freq='D')
df= pd.DataFrame({'Date': rng, 'Val': np.random.randint(50, 80, size=365), 'Node': 'A'})

df.sort_values('Date',inplace=True)

df['C'] = (df.loc[(df["Val"] > 60) & (df["Val"] <= 70)]
.groupby([df["Date"].dt.month, (df['Val'] == 70).cumsum()])).cumcount() + 1

as we only want values that hit 70 in that month we need to set the counts to 0 if 70 was not reached within a given month, we can filter by months and return these into a list then filter by using isin
months = df.loc[df['Val'] == 70]['Date'].dt.month.tolist()
df.loc[~df['Date'].dt.month.isin(months),'C'] = 0
df1 = (df.groupby([df['Node'],df['Date'].dt.month])['C'].max()
        .reset_index().rename(columns={'Date' : 'Month'}))
    print(df1) 

    Node  Month     C
0     A      1   0.0
1     A      2   6.0
2     A      3   7.0
3     A      4  11.0
4     A      5   7.0
5     A      6   5.0
6     A      7   6.0
7     A      8   0.0
8     A      9   4.0
9     A     10   0.0
10    A     11   9.0
11    A     12   0.0

