Does word "affinity" have the same meaning in the following two sentences?

An affinity for politics.

James's affinity with Sam.
the same meaning