For those who are looking for a fix for Maya perspective camera nan
Type this mel code in the script editor!
select -r persp;
ResetTransformations;
GoToDefaultView;
Below is the python version code. [UNTESTED!]
import maya.cmds as cmds
import maya.mel as mel
cmds.select('persp',r=True);
mel.eval('ResetTransformations');
mel.eval('GoToDefaultView');