Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'NaTType' object has no attribute 'ordinal' #699

Open
bird-is opened this issue May 23, 2023 · 0 comments
Open

'NaTType' object has no attribute 'ordinal' #699

bird-is opened this issue May 23, 2023 · 0 comments

Comments

@bird-is
Copy link

bird-is commented May 23, 2023

Problem Description

Please provide a minimal, self-contained, and reproducible example:

`df = pd.DataFrame(daily_return)
dt_index = pd.to_datetime(df['day'])
return_series = df['yield']
return_series.index = dt_index
return_series = return_series.tz_localize('UTC')

fig = pf.create_returns_tear_sheet(return_series, return_fig=True)`

In lib, I modify mdd top 5 -> 3, then it works well. Thus I think if I don't have enough period MDD top have to smaller.

`
@plotting.customize
def create_returns_tear_sheet(
    returns,
    positions=None,
    transactions=None,
    live_start_date=None,
    cone_std=(1.0, 1.5, 2.0),
    benchmark_rets=None,
    bootstrap=False,
    turnover_denom="AGB",
    header_rows=None,
    return_fig=False,
):
    ....

    # [ASIS] Drawdowns
    plotting.plot_drawdown_periods(returns, top=5, ax=ax_drawdown)

    # [TOBE] Drawdowns
    plotting.plot_drawdown_periods(returns, top=3, ax=ax_drawdown)

`

Please provide the full traceback:

예외가 발생했습니다. ConversionError
Failed to convert value(s) to axis units: (NaT, Timestamp('2023-05-21 00:00:00+0000', tz='UTC'))
AttributeError: 'NaTType' object has no attribute 'ordinal'

The above exception was the direct cause of the following exception:

  File "D:\Project\01. project\trToyerBackend\view\analysis_view.py", line 121, in <module>
    fig = pf.create_returns_tear_sheet(return_series, return_fig=True,)
matplotlib.units.ConversionError: Failed to convert value(s) to axis units: (NaT, Timestamp('2023-05-21 00:00:00+0000', tz='UTC'))

Please provide any additional information below:
This is my sample data. my.csv

Versions

  • Pyfolio version: 0.9.5 (pyfolio-reloaded)
  • Python version: 3.9
  • Pandas version: 1.5.2
  • Matplotlib version: 3.7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant