@@ -330,8 +330,9 @@ def create_position_tear_sheet(returns, positions, gross_lev=None,
330
330
If True, returns the figure that was plotted on.
331
331
set_context : boolean, optional
332
332
If True, set default plotting style context.
333
- sector_mapping:
334
- Dictionary or Series.
333
+ sector_mapping: dict or pd.Series.
334
+ Security identifier to sector mapping.
335
+ Security ids as keys, sectors as values.
335
336
"""
336
337
337
338
vertical_sections = 5 if sector_mappings else 4
@@ -361,14 +362,11 @@ def create_position_tear_sheet(returns, positions, gross_lev=None,
361
362
if sector_mappings is not None :
362
363
sector_exposures = pos .get_sector_exposures (positions , sector_mappings )
363
364
364
- if sector_exposures is None :
365
- return
366
-
367
365
sector_alloc = pos .get_percent_alloc (sector_exposures )
368
- sector_alloc = sector_alloc .drop ('cash' , axis = 1 )
369
-
366
+ sector_alloc = sector_alloc .drop ('cash' , axis = 'columns' )
370
367
ax_sector_alloc = plt .subplot (gs [4 , :], sharex = ax_gross_leverage )
371
- plotting .plot_sector_allocations (returns , sector_alloc , ax = ax_sector_alloc )
368
+ plotting .plot_sector_allocations (returns , sector_alloc ,
369
+ ax = ax_sector_alloc )
372
370
373
371
plt .show ()
374
372
if return_fig :
0 commit comments