importsysimportnumpyasnpfromscipyimportstats### Normality Check# H0: data is normally distributeddefnormality_check(data_A, data_B, name, alpha):if(name=="Shapiro-Wilk"):# Shapiro-Wilk: Perform the Shapiro-Wilk test for normality.shapiro_results = stats.shapiro([a - bfora, binzip(data_A...
import pandas as pd # 数据加载与清洗 data = pd.read_csv('financial_data.csv') data['Date'...
ks_results = stats.kstest([a - b for a, b in zip(data_A, data_B)], 'norm') return ks_results[1] ## McNemar test def calculateContingency(data_A, data_B, n): ABrr = 0 ABrw = 0 ABwr = 0 ABww = 0 for i in range(0,n): if(data_A[i]==1 and data_B[i]==1): ...
if len(testData) <50: p_value= stats.shapiro(testData)[1] if p_value<0.05: print "use shapiro:" print "data are not normal distributed" return False else: print "use shapiro:" print "data are normal distributed" return True if 300>=len(testData) >=50: p_value= lillifors(test...
Figure 7.4: Plot of the time series data that we will analyze. There doesn't appear to be a trendinthis data3.Next, we compute the augmented Dickey-Fuller test. The null hypothesisisthat the time seriesisnotstationary: adf_results = sm.tsa.adfuller(sample_ts) ...
If you want to add a pip.conf file, then you can choose one of the locations that pip config list -vv listed. A pip.conf file with a custom package index looks like this:Configuration File pip.conf [global] index-url = https://test.pypi.org/simple/ ...
In short, though, one way to statically link the extension of Example 22-1 is to add a line such as the following: hello ~/PP3E/Integrate/Extend/Hello/hello.c to the Modules/Setup configuration file in the Python source code tree (change the ~ if this isn't in your home directory)...
def talk(message): return "Talk " + message def main(): print(talk("Hello World")) if __name__ == "__main__": main() Test your program Do as you normally would. Running Nuitka on code that works incorrectly is not easier to debug. python hello.py Build it using python -m nu...
Python is simple, but not simplistic. It adheres to the idea that, if a language behaves a certain way in some contexts, it should ideally work similarly in all contexts. Python also follows the principle that a language should not have “convenient” shortcuts, special cases, ad hoc excep...
Windows C:\Users\<username>\AppData\Local\pypoetry\Cache macOS /Users/<username>/Library/Caches/pypoetry Linux /home/<username>/.cache/pypoetry If you want to change the default cache directory, then you can edit Poetry’s configuration. It can be useful when you already use virtualenvwrappe...