python


VisibleDeprecationWarning when creating random array of size 2e5


I defined var1, var2 as the following arrays:
N = 2e5
var1 = np.array(50 * np.random.normal(size=N) + 0.1)
var2 = np.array(0.01 * np.random.normal(size=N) - 300)
Upon running these 3 statements in python I get the following two warnings:
__main__:7: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
__main__:8: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
How do I correct this?
The size must be an integer. You used N=2e5 but that's a float, you can instead just use 2 * 10**5:
>>> type(2e5)
float
>>> type(2*10**5)
int
Or otherwise convert the value to an integer.
You can't use floats or double as indexes, convert the result into an Int:
import numpy as np
N = int(2e5)
var1 = np.array(50*np.random.normal(size=N) + 0.1)
var2 = np.array(0.01*np.random.normal(size=N) - 300)

Related Links

Organise .rst files for sphinx?
Scatter Plot of a Specific Column in Python using matplotlib
How to make difference between email html body and html attachment in python?
Cobb-Douglas maximization in python
Django won't serve some static files
Flask return SUM into Jinja2 list
i tried this sql request on python but is not working
Passing command line arguments in python by pytest
Not using grid anywhere in class still gives error 'cannot use geometry manager pack inside . which already has slaves managed by grid' in tkinter
Minimax Alogrithm for TicTacToe [python]
Zero Crossings Rate
Recursive function with one argument that does something to each element
Storing and Graphing results of API queried via Python. [on hold]
While handling Exceptions, how to print any error statement that occurs? See below for more details
Having trouble getting my calculator app to print the result I want
Why am I getting this ValueError?

Categories

HOME
json
google-apps-script
sql-server
rotation
agile
parse-server
chaiscript
apache2
appmaker
javamail
metronic
hosts
cortex-a
gwtp
cratedb
typeahead
bar-chart
factor-analysis
off-canvas-menu
jpeg2000
ms-access-2007
movies
rails-activerecord
epicor
qsub
jflex
hanami
fetch-api
weinre
sharp
ipfw
m2e
hotmail
ocs
ios-ui-automation
pox
es-shell
discord.net
android-download-manager
topic-modeling
delphi-10.1-berlin
flex4.5
common.logging
wcf-security
exiftool
automator
lumen-5.3
istorage
multi-agent
opencpu
sqlexception
project-template
rsqlite
keycode
payu
atlassian-crowd
spring-ioc
gitweb
spark-cassandra-connector
multiple-file-upload
spatial-query
coordinate-transformation
multilingual-app-toolkit
fps
anti-cheat
xmp
galaxy
getrusage
direct3d12
wikitext
textkit
webhdfs
google-earth-plugin
cpan
cocoascript
em
collabnet
iostream
dto
outline
factors
zipalign
edit-in-place
chrome-for-android
confusion-matrix
trimming
grunt-contrib-compass
appfog
awesomeprint
graph-coloring
htmltextwriter
phpsh
returnurl
tfs-power-tools
flexicious
emacs23
selectonemenu
hashalgorithm
newsstand-kit
executable-format
dcpu-16
ihttphandler
ets
getresource
querypath
osx-leopard
longjmp
internals
system-codedom-compiler
data-entry

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App