Skip to content

Crash when running best_moving_averages_analysis.py #39

@Beliavsky

Description

@Beliavsky

Using Python 3.13.1, running

python best_moving_averages_analysis.py

gave

Traceback (most recent call last):
  File "c:\python3\code\public_domain\github\Finance\portfolio_strategies\best_moving_averages_analysis.py", line 40, in <module>
    data['Position'] = data['Close'] > data['SMA']
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\programs\Python313\Lib\site-packages\pandas\core\ops\common.py", line 76, in new_method
    return method(self, other)
  File "c:\programs\Python313\Lib\site-packages\pandas\core\arraylike.py", line 56, in __gt__
    return self._cmp_method(other, operator.gt)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "c:\programs\Python313\Lib\site-packages\pandas\core\frame.py", line 7897, in _cmp_method
    self, other = self._align_for_op(other, axis, flex=False, level=None)
                  ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\programs\Python313\Lib\site-packages\pandas\core\frame.py", line 8205, in _align_for_op
    raise ValueError(
    ...<3 lines>...
    )
ValueError: Operands are not aligned. Do `left, right = left.align(right, axis=1, copy=False)` before operating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions