DALP | Distance Academic Learning Platform
kandi X-RAY | DALP Summary
kandi X-RAY | DALP Summary
Most of the students are not endowed with a high bandwidth internet connection. These students are then particularly not able to take advantage of realtime online classes. Low bandwidth mode solves this problem by -.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of DALP
DALP Key Features
DALP Examples and Code Snippets
Community Discussions
Trending Discussions on DALP
QUESTION
I am building out a calculator that takes in various statistical distributions of variables and multiplies them together. I am having issues returning values from my entry boxes to be used in my calculations. All 6 numbers that need to be entered into the calculator are float variables.
I have abbreviated and altered the code slightly to make it easier to understand the error.
My thought process is this.
- I initially define all variable that will be called from the entry box using StringVar() assignments
- I then set up the entry boxes to take the input variables set up in step 1
- I call the entered items into the calculation function by by using the variablename.get() method and cast them as float variables
- I use the numpy random.choice function to generate a discrete distribution from the inputs provided.
step 4 is where I am having issues. I am getting a type error stating that "'float object' cannot be interpreted as an integer". I don't know where Python is trying to interpret an integer at in this script. I thought I had cast all of my variables to float.
...ANSWER
Answered 2018-Aug-31 at 08:04The issue is with this line below:
problemex= np.random.choice([dalv,dabv,dahv], dnumbint, p=[dalp,dabp,dahp] )
If you see the traceback error and read the numpy documentation , the error is quite obvious.
The size
parameter in this case dumbint
must be an integer but you have passed a float
.
So typecast it into int
and you should be fine.
In fact replacing with the line below makes the program work:
problemex= np.random.choice([dalv,dabv,dahv], int(dnumbint), p=[dalp,dabp,dahp] )
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install DALP
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page