Nearest Neighbor

Is there any pre defined method(function) to calculate distance and angle(s) between the site and its nearest neighboring atoms?
Secondly, how can I calculate valence electronic configuration of an element?

Thanks in advance.

Check out the local_env module of Pymatgen for determining nearest neighbors:
https://pymatgen.org/pymatgen.analysis.local_env.html

For your second question there is another module:
https://pymatgen.org/pymatgen.core.periodic_table.html