Quantcast
Channel: TypeError: 'float' object cannot be interpreted as an index - Stack Overflow
Viewing all articles
Browse latest Browse all 2

TypeError: 'float' object cannot be interpreted as an index

$
0
0

I am facing an issue which was not occurring before, maybe some rules have been changed.

    Traceback (most recent call last)<ipython-input-3-f47687e192a7> in <module>()          5 n_examples = X.shape[0]          6 n_train = n_examples * 0.5    ----> 7 train_idx = np.random.choice(range(0,n_examples), size=n_train, replace=False)          8 test_idx = list(set(range(0,n_examples))-set(train_idx))          9 X_train = X[train_idx]    mtrand.pyx in mtrand.RandomState.choice (numpy/random/mtrand/mtrand.c:18822)()    TypeError: 'float' object cannot be interpreted as an index

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>