
import numpy as np


def _py2intround(a):
    """
    Round the input to the nearest integer.

    If two integers are equally close, rounding is done away from 0.
    """
    data = np.asanyarray(a)
    value = np.where(data >= 0, np.floor(data + 0.5),
                     np.ceil(data - 0.5)).astype(int)

    if not hasattr(a, '__iter__'):
        value = np.asscalar(value)

    return value


import numpy as np


def _py2intround(a):
    """
    Round the input to the nearest integer.

    If two integers are equally close, rounding is done away from 0.
    """
    data = np.asanyarray(a)
    value = np.where(data >= 0, np.floor(data + 0.5),
                     np.ceil(data - 0.5)).astype(int)

    if not hasattr(a, '__iter__'):
        value = value.item()

    return value

Replace deprecated np.asscalar(a) with a.item()
Replace deprecated np.asscalar(a) with a.item()

  
  import numpy as np
  
  
  def _py2intround(a):
      """
      Round the input to the nearest integer.
  
      If two integers are equally close, rounding is done away from 0.
      """
      data = np.asanyarray(a)
      value = np.where(data >= 0, np.floor(data + 0.5),
                       np.ceil(data - 0.5)).astype(int)
  
      if not hasattr(a, '__iter__'):
-         value = np.asscalar(value)
+         value = value.item()
  
      return value
  
Replace deprecated np.asscalar(a) with a.item()
## Code Before:

import numpy as np


def _py2intround(a):
    """
    Round the input to the nearest integer.

    If two integers are equally close, rounding is done away from 0.
    """
    data = np.asanyarray(a)
    value = np.where(data >= 0, np.floor(data + 0.5),
                     np.ceil(data - 0.5)).astype(int)

    if not hasattr(a, '__iter__'):
        value = np.asscalar(value)

    return value

## Instruction:
Replace deprecated np.asscalar(a) with a.item()
## Code After:

import numpy as np


def _py2intround(a):
    """
    Round the input to the nearest integer.

    If two integers are equally close, rounding is done away from 0.
    """
    data = np.asanyarray(a)
    value = np.where(data >= 0, np.floor(data + 0.5),
                     np.ceil(data - 0.5)).astype(int)

    if not hasattr(a, '__iter__'):
        value = value.item()

    return value
