title: Selecting map features and zooming in on selected features does not work
body: <p>Below is my code for projecting xy coordinates from a csv, creating a shapefile from it, loading a shapefile into an existing mxd document, adding labels, selecting features, zooming in on selected features and exporting a map. Ultimately, I want to export about three different maps so i would have to loop through selected features, zooming and exporting. My code runs with no errors. However the selecting features and zooming in on selected features does not work. I simplified the code right now until i can move on to something more complex involving labeling multiple features, selecting multiple features, and looping through the select, zoom and export of maps. Below is my code. I think the first problem is how do i fix the selecting features and zooming to selected feature. Any help is appreciated.</p>
  
  <pre><code>import pandas as pd
  import arcpy
  
  in_csv = 'C:/Users\Hector Hernandez/Documents/GitHub/pratt-savi-810-2018-10/students/hhernandez2783/Test/brg.csv'
  
  df = pd.read_csv(in_csv)
  
  out_csv = in_csv
  
  # project xy coordinates
  arcpy.MakeXYEventLayer_management(
       out_csv,
       'Brg_Lng',
       'Brg_Lat',
       'in_memory_xy_layer',
   )
  
  # create a shapefile
  arcpy.FeatureClassToFeatureClass_conversion(
       'in_memory_xy_layer',
       'C:/Users\Hector Hernandez/Documents/GitHub/pratt-savi-810-2018-10/students/hhernandez2783/Test',
       'brg.shp'
  )
  
  # loading shapefile in map document
  # get the map document
  mxd = arcpy.mapping.MapDocument(r"C:\Users\Hector Hernandez\Documents\GitHub\pratt-savi-810-2018-10\students\hhernandez2783\Test\ld.mxd")
  # Set the workspace
  arcpy.env.workspace = r"C:\Users\Hector Hernandez\Documents\GitHub\pratt-savi-810-2018-10\students\hhernandez2783\Test"
  # get the data frame
  df = arcpy.mapping.ListDataFrames(mxd,"*")[0]
  # create a new layer
  newlayer = arcpy.mapping.Layer(r"C:\Users\Hector Hernandez\Documents\GitHub\pratt-savi-810-2018-10\students\hhernandez2783\Test\brg.shp")
  # add the layer to the map at the bottom of the TOC in data frame 0
  arcpy.mapping.AddLayer(df, newlayer,"AUTO_ARRANGE")
  # save the mxd file
  mxd.save()
  
  
  # adding labeling
  layer = arcpy.mapping.ListLayers(mxd, "brg")[0] #Indexing list for 1st layer
  if layer.supports("LABELCLASSES"):
      for lblclass in layer.labelClasses:
          lblclass.showClassLabels = True
  layer.showLabels = True
  arcpy.RefreshActiveView()
  mxd.save()
  
  # select features &amp; zoom
  nycbrg = arcpy.mapping.ListLayers(mxd, "brg", df)[0]
  arcpy.SelectLayerByAttribute_management(nycbrg, "NEW_SELECTION", """ "brg" = 'Brooklyn Bridge' """)
  df.zoomToSelectedFeatures()
  
  # export map
  arcpy.mapping.ExportToPNG(mxd, r'C:\Users\Hector Hernandez\Documents\GitHub\pratt-savi-810-2018-10\students\hhernandez2783\Test\expmap1.png')
  </code></pre>