How do I define a function to extract values from nested dictionary for each row in python

Given pandas series s (I'm assuming it's a pandas series)

s = pd.Series([{'url example 1': {'malicious': False}},
               {'url example 2': {'malicious': False}}])

you can use generator expression inside next to look for values of nested dicts.

out = s.apply(lambda url: next((v for d in url.values() for k,v in d.items()), None))

Output:

0    False
1    False
dtype: bool

However, I'm not convinced this is what you're looking for since you're losing the url info here.