BUG: fix NameError issue in GH2787
Merge pull request #3135 from jreback/GH2787

BUG: fix NameError issue in GH2787