I tried using the np.isin() function but everytime I do, it returns me the error: AttributeError: 'module' object has no attribute 'isin' here is exactly what I do import numpy as np a = np.arange(9).reshape((3,3)) test = np.arange(5) print np.isin(a, test) I havent found any ...

## Discy Latest Questions

What is the difference between these two numpy objects? import numpy as np np.array([[0,0,0,0]]) np.array([0,0,0,0])

I want to replace number 3 instead of all ‘nan’ in array. this is my code: train= train.replace("nan",int(3)) But nothing changes in my array. Could u please guide me?

I want to use numpy.exp like this: cc = np.array([ [0.120,0.34,-1234.1] ]) print 1/(1+np.exp(-cc)) But this gives me error: /usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:5: RuntimeWarning: overflow encountered in exp I can’t understand why? How can I fix this? It seems the problem is with third ...

I am isolating some row ids from a Pandas dataframe, like this: data = df.loc[df.cell == id] rows = df.index print(type(rows)) < class 'pandas.indexes.numeric.Int64Index'> I want to convert rows to a numpy array so I can save it to a mat file ...

The following formula is used to classify points from a 2-dimensional space: f(x1,x2) = np.sign(x1^2+x2^2-.6) All points are in space X = [-1,1] x [-1,1] with a uniform probability of picking each x. Now I would like to visualize the circle ...

I want to take the logarithm of every value in a pandas dataframe. I have tried this but it does not work: #Reading data from excel and rounding values on 2 decimal places import math import pandas as pd data = pd.read_excel("DataSet.xls").round(2) log_data= ...

I loaded a text file containing a two column matrix (e.g. below) [ 1 3 2 4 3 5 2 0] My calculation is just to sum ...

I have a 4D array training images, whose dimensions correspond to (image_number,channels,width,height). I also have a 2D target labels，whose dimensions correspond to (image_number,class_number). When training, I want to randomly shuffle the data by using random.shuffle, but how can ...

I’m new to pandas & numpy. I’m running a simple program labels = ['a','b','c','d','e'] s = Series(randn(5),index=labels) print(s) getting the following error s = Series(randn(5),index=labels) File "C:\Python27\lib\site-packages\pandas\core\series.py", line 243, in __init__ raise_cast_failure=True) ...