Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

t-test python

# Python program to demonstrate how to
# perform two sample T-test
 
# Import the library
import scipy.stats as stats
 
# Creating data groups
data_group1 = np.array([14, 15, 15, 16, 13, 8, 14,
                        17, 16, 14, 19, 20, 21, 15,
                        15, 16, 16, 13, 14, 12])
 
data_group2 = np.array([15, 17, 14, 17, 14, 8, 12,
                        19, 19, 14, 17, 22, 24, 16,
                        13, 16, 13, 18, 15, 13])
 
# Perform the two sample t-test with equal variances
stats.ttest_ind(a=data_group1, b=data_group2, equal_var=True)
Comment

test with python

"""Testing the methods"""


import unittest
from unittest import TestCase
from palindrome import is_palindrome
from prime_number import is_prime


class TestingFunctions(TestCase):
    """Tests to know if the methods works well"""
    
    def test_is_palindrome(self):
        """Testing is_palindrome method"""
        self.assertEqual(is_palindrome('Ligar es ser agil'), True)
        self.assertEqual(is_palindrome('Arepera'), True)
        self.assertEqual(is_palindrome('Esto no es un palindromo'), False)
        self.assertEqual(is_palindrome('ESto tampoco es un palindromo'), False)
        self.assertEqual(is_palindrome('Ana'), True)

    def test_is_prime(self):
        """Testing is_prime method"""
        self.assertEqual(is_prime(100), False)
        self.assertEqual(is_prime(200), False)
        self.assertEqual(is_prime(53), True)
        self.assertEqual(is_prime(23), True)
        self.assertEqual(is_prime(45), False)
        self.assertEqual(is_prime(32), False)
        self.assertEqual(is_prime(142), False)


if __name__ == '__main__':
    unittest.main()
Comment

python t test

# Python program to conduct two-sample
# T-test using pingouin library
 
# Importing library
from statsmodels.stats.weightstats import ttest_ind
import numpy as np
import pingouin as pg
 
# Creating data groups
data_group1 = np.array([160, 150, 160, 156.12, 163.24,
                        160.56, 168.56, 174.12,
                        167.123, 165.12])
data_group2 = np.array([157.97, 146, 140.2, 170.15,
                        167.34, 176.123, 162.35, 159.123,
                        169.43, 148.123])
 
# Conducting two-sample ttest
result = pg.ttest(data_group1,
                  data_group2,
                  correction=True)
 
# Print the result
print(result)
Comment

PREVIOUS NEXT
Code Example
Python :: python os get dir path 
Python :: create virtual environment python stack overflow 
Python :: uppercase python 
Python :: number of elements in the array numpy 
Python :: request session python 
Python :: merge keep left index 
Python :: python A string float numeral into integer 
Python :: split the column value and take first value in pandas 
Python :: arrays python 
Python :: numpy reshape (n ) to (n 1) 
Python :: check audio playing on windows python 
Python :: flask socketio usage 
Python :: add timestamp csv python 
Python :: python namedtuples 
Python :: Concat Sort codechef solution 
Python :: Appending rows to a DataFrame 
Python :: how to make lowercase text in python 
Python :: python recognize every white color 
Python :: #adding new str to set in python 
Python :: stop flask server 
Python :: pyspark dataframe to dictionary 
Python :: cropping image google colab 
Python :: standard deviation in python numpy 
Python :: python glob.glob recursive 
Python :: python relative import 
Python :: django email 
Python :: add item to tuple python 
Python :: Add two numbers as a linked list 
Python :: repeat rows in a pandas dataframe based on column value 
Python :: for loops python 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =