From the course: Introduction to Data Science

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Conducting a permutation test

Conducting a permutation test

The process behind creating a permutation is an important building block for conducting a permutation test. In this lesson, I'll show you how to conduct a permutation test. Feel free to open the corresponding exercise file to follow along. Now, I'll need to permute the data more than once, so it'd be helpful to have a function that I can call whenever I want to permute the data. So I've defined a function that allows me to do this. And I named the function "Perm." I started with the keyword def, followed by the name of the function, which is perm parentheses, and then data. And data will be a generic representation of the data I can pass in as input to this function. Next was colon. In the body of the function, I used the keyword return followed by a call to the sample method setting frac to one, followed by a call to the reset index method setting drop to true. I want to determine if there's an association between growth duration and whether fertilizer was used. In order to do this…

Contents