Skip to content Skip to sidebar Skip to footer

Argsort In Python3

I am wondering why I get different results by using argsort in Python2 and Python3. My codes are as follows: ## Import Data allWrdMat10 = pd.read_csv('../../data/allWrdMat10.csv.gz

Solution 1:

values() (and keys()) return view objects backed by the dict on Python 3, rather than lists. numpy.array can't convert a dict view to an array.

You can call list on the views to get a list, but rather than doing that, I'd recommend eliminating the dict entirely. You don't seem to be doing anything but calling keys() and values() on it.

Post a Comment for "Argsort In Python3"