Using get() method in Python to return value of the key in dictionary

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Python’s dictionary object type provides a function get() to return the value of the key in a dictionary. The difference between get() method and using bracket to index the key is that get() will return NULL in result when the key is not present, while the latter raises an error for nonexistent key. Read more…

Nesting dictionary in Python

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Dictionary in Python is a useful data object that stores key-value paired information. It can be nested, combined with lists or with dictionaries. In this post, we briefly introduce three nesting dictionary structures: dictionaries inside a list, lists inside a dictionary, and dictionaries inside a dictionary. The most useful case of this hierarchical Read more…

How to loop through a dictionary in Python

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Dictionary objects in Python make storing key-value pairs information fairly easy and straightforward. The information of the dictionary can be returned by using a for loop. There are usually three type of for loops mentioned with respect to the dictionary’s attributes: ‘items’ for getting key-value pairs, ‘keys’ for returning all the keys and Read more…

How to calculate binomial distribution in Python

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Binomial distribution in statistics is a type of discrete probability distribution, modeling the probability of success times among a predetermined Bernoulli process. A Bernoulli process is a binary experiment with result success or fail, in which the probability of success or fail is constant for each independent trial. The most striking point for Read more…

Tuple-Immutable list in Python

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Python object tuple is a type of list in which the elements can not be modified. It is immutable. When the elements are stored information that are stable, like the area of countries, values of genders, you can use tuples. Tuples are created using parentheses. In the following code, two tuples representing countries Read more…

List comprehension in Python

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! List comprehension is a concise way to create a list in Python. It is usually a composition of an expression with a for loop statement in the bracket. In the following code, we create a list of squared numbers using list comprehension. Here can we see element**2 is the expression. The later part Read more…

Power analysis for t-test using R

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Power analysis is a part of planning analysis for experimental design. It is usually used to determine the minimum sample size required to detect a specified effect with a power level confidence, simultaneously with no larger than a significant level which wrongly reject and affirm the effect when it actually does not exist. Read more…

How to generate descriptive statistics in R

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! When we have a data set on hand, the first step of data analysis is usually drawing descriptive statistics. The most common descriptive statistics for numerical variables are mean or average, median, minimum and maximum value. summary() in R provides the list of descriptive statistics mentioned. An alternative is using describe() function from Read more…

Some basic mathematical functions in R

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! In this post, we list some of the most common mathematical functions in R. abs() – compute absolute value of a numerical input. sqrt() – compute square root of numerical input. ceiling() – return the lowest integer no less than the input number. floor() – return the largest integer no larger than the Read more…

How to modify data frame using transform() function in R

We provide effective and economically affordable online training courses for R and Python, click here for more details and course registration ! Similar as with() function in R, transform() function provides a way to work on data frame with simplified code inside its block. transform() is mostly used to modify a data frame in a concise and explicit manner. The basic form of usage is transform(df, new_var = operation) Where df is the object data Read more…