numpy/scipy deprecation warning for "rank"

  • Last Update :
  • Techknowledgy :

I have some python code which uses numpy and have run this successfully for a year or more. I suddenly got the following error last week:

/usr/local / lib / python2 .7 / dist - packages / numpy / core / fromnumeric.py: 2507: VisibleDeprecationWarning: `rank`
is deprecated;
use the `ndim`
attribute or
function instead.To find the rank of a matrix see `numpy.linalg.matrix_rank`.
VisibleDeprecationWarning)

Suggestion : 2

I have some python code which uses numpy and have run this successfully for a year or more. I suddenly got the following error last week:, This API can be best described as “organic”. It has emerged from multiple competing desires and from multiple points of view over the years, strongly influenced by the desire to make it easy for users to move to NumPy from Numeric and Numarray. ,The display of third-party trademarks and trade names on this site does not necessarily indicate any affiliation or endorsement of FaqCode4U.com.,I can't find much on this online, but I found a suggestion that this was due to a bug in old versions of scipy (although my code doesn't actually use scipy directly). I've upgraded to python 2.7.9 with numpy 1.9.2 and scipy 0.15.1, however I'm still getting the same error. I'm not sure what's causing this, or how I fix this.


/usr/local / lib / python2 .7 / dist - packages / numpy / core / fromnumeric.py: 2507: VisibleDeprecationWarning: `rank`
is deprecated;
use the `ndim`
attribute or
function instead.To find the rank of a matrix see `numpy.linalg.matrix_rank`.VisibleDeprecationWarning)
/usr/local / lib / python2 .7 / dist - packages / numpy / core / fromnumeric.py: 2507: VisibleDeprecationWarning: `rank`
is deprecated;
use the `ndim`
attribute or
function instead.To find the rank of a matrix see `numpy.linalg.matrix_rank`.VisibleDeprecationWarning)

Suggestion : 3

In future numpy releases, the functions np.fromfile and np.fromstring will throw an error when parsing bad data. This will now give a DeprecationWarning where previously partial or even invalid data was silently returned. This deprecation also affects the C defined functions PyArray_FromString and PyArray_FromFile (gh-13605),In addition to the usual bug fixes, this NumPy release cleans up and documents the new random C-API, expires a large number of old deprecations, and improves the appearance of the documentation. The Python versions supported are 3.5-3.8. This is the last NumPy release series that will support Python 3.5.,np.rank has been removed. This was deprecated in NumPy 1.10 and has been replaced by np.ndim. (gh-14039),In accordance with NEP-32, the financial functions fv ipmt, irr, mirr, nper, npv, pmt, ppmt, pv and rate are deprecated, and will be removed from NumPy 1.20.The replacement for these functions is the Python package numpy-financial. (gh-14720)

dropped_arr = drop_fields(arr, ['a', 'b'])
if dropped_arr.dtype.names == ():
   dropped_arr = None