Skip to content

Commit c01cefa

Browse files
committed
pr fixes
1 parent a71b13d commit c01cefa

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pyfolio/tears.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,9 @@ def create_position_tear_sheet(returns, positions, gross_lev=None,
330330
If True, returns the figure that was plotted on.
331331
set_context : boolean, optional
332332
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.
335336
"""
336337

337338
vertical_sections = 5 if sector_mappings else 4
@@ -361,14 +362,11 @@ def create_position_tear_sheet(returns, positions, gross_lev=None,
361362
if sector_mappings is not None:
362363
sector_exposures = pos.get_sector_exposures(positions, sector_mappings)
363364

364-
if sector_exposures is None:
365-
return
366-
367365
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')
370367
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)
372370

373371
plt.show()
374372
if return_fig:

0 commit comments

Comments
 (0)