Creating Numpy arrays using ones(),zeros(),arange(), reshape(), linspace() and random() in Python

We provide affordable online training course(via ZOOM meeting) for Python and R programming at fundamental level, click here for more details. In addition to using array() function that passes a list or tuple to generate an Numpy array in Python, there are lots of ready-made functions that make it possible to generate large size Numpy arrays in Python. Following code examples show some of the most common functions in that respect. You can also watch Read more…

Introducing Numpy array in Python

We provide affordable online training course(via ZOOM meeting) for Python and R programming at fundamental level, click here for more details. Numpy is a large module in Python programming. It handles mainly numeric data analysis, and is also the basis of another large module, Pandas in Python. The heart of Numpy is data object type ndarray. Numpy array stores same type of data in an array. An array usually has dimension (how many axes, or Read more…

How to calculate probability from Negative Binomial distribution in R

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Negative binomial distribution is used to model the particular probability of k-th success occurring at x-th Bernoulli trial, which is equivalent to say that it has experienced x-1 trial and the last trial is a success. A Bernoulli trial is a trial with binary result, success and failure, with a constant success rate Read more…

How to calculate probability of Hypergeometric distribution in R

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Hypergeometric distribution is connected with taking n items (no replacement) from N items, where k items labeled success and N-k items failure. The success number x of n selected items follows hypergeometric distribution. To calculate the probability of x using R, function dhyper() can be applied. The basic form of the function is: Read more…

How to calculate binomial distribution in R

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Binomial distribution is a discrete random distribution modeling the probability of event success number x in N Bernoulli trial. A Bernoulli trial is an experiment of binary (success/fail) result with a constant success rate in each trial. To calculate the probability for individual success number x in R, function dbinom() can be used. Read more…

Using while loop to move items between two lists in Python

We provide affordable online training course(via ZOOM meeting) for Python and R programming at fundamental level, click here for more details. It is very often that items in list should be moved to another list in Python programming. For example, users trying to register on a website can only be moved to a verified user list after certain conditions are met. In such circumstance, a while loop can be applied. You can also watch videos Read more…

How to copy a list in Python

We provide affordable online training course(via ZOOM meeting) for Python and R programming at fundamental level, click here for more details. The mechanism for copying a list in Python appears somewhat different than in other programming languages. If you just use equal symbol to assign an existing list to a new one, both objects refer to the same one which is stored in the computers memory. Say we have a list for favorite languages and Read more…

How to pass arbitrary number of information when calling a function in Python

We provide affordable online training course(via ZOOM meeting) for Python and R programming at fundamental level, click here for more details. After a function is defined and will be called, it is natural to pass required information in the calling statement. In the following example, we create a function about traveling with parameter person and country, for printing the country people have recently traveled. Sometimes, there are multiple elements that will be passed as the Read more…

Using while loop to remove all specific elements from a list in Python

rdatacode provide affordable online training course(via ZOOM meeting) for Python and R programming at fundamental level, click here for more details. Python provides function remove() to remove items in a list based on its value, but it removes only the first occurrence of instances if there are more than one such items existing in the list. From the code example above, we can see there is still a “Toyota” present in the list after we Read more…

Conditional test if items in a list in Python

rdatacode provide affordable online training course for Python and R programming at fundamental level, click here for more details. If you want to test if some particular items are in a list, you can use ‘in’ or ‘not in’ keywords in Python. Consider that we have a list containing names of 6 student candidates, then we can test if ‘Bob’ or ‘White’ are in the list. Sometimes you can also test whether some items are Read more…