示例#1
0
# -*- coding: utf-8 -*-
"""
@author: David R Hagen
@license: MIT
"""

from scipy.stats import norm

from general_setup import smooth_data,median_over_months,sum_over_patterns,filter_for_specific_day,plot_me
from load_data import good_XXth_data,bad_XXth_data,bad_nth_data

# Good medians
good_XXth_medians = median_over_months(good_XXth_data)
good_XXth_medians_smooth = smooth_data(good_XXth_medians, 5)

# The day of interest
only_11th = filter_for_specific_day(good_XXth_data, '11th')
only_11th_medians_smooth = good_XXth_medians_smooth[['year','11th']]

# Bad sums
sum_bad_XXth = sum_over_patterns(bad_XXth_data, new_name='badth')

# Sum of good and bad
sum_bad_XXth_and_11th = sum_over_patterns(only_11th.merge(bad_XXth_data, on='year'), new_name='allth')
sum_bad_XXth_and_11th_medians = median_over_months(sum_bad_XXth_and_11th)
sum_bad_XXth_and_11th_medians_smooth = smooth_data(sum_bad_XXth_and_11th_medians, 5)

# Difference between good and sum of bad and good (not necessarily equal to sum of bad alone)
sum_XXth_minus_bad_medians = sum_bad_XXth_and_11th_medians.copy()
sum_XXth_minus_bad_medians.columns = ['year', 'diffth']
sum_XXth_minus_bad_medians['diffth'] = sum_bad_XXth_and_11th_medians['allth'] - good_XXth_medians['11th']
示例#2
0
# -*- coding: utf-8 -*-
"""
@author: David R Hagen
@license: MIT
"""

from scipy.stats import norm

from general_setup import smooth_data, median_over_months, sum_over_patterns, filter_for_specific_day, plot_me
from load_data import good_XXth_data, bad_XXth_data, bad_nth_data

# Good medians
good_XXth_medians = median_over_months(good_XXth_data)
good_XXth_medians_smooth = smooth_data(good_XXth_medians, 5)

# The day of interest
only_11th = filter_for_specific_day(good_XXth_data, '11th')
only_11th_medians_smooth = good_XXth_medians_smooth[['year', '11th']]

# Bad sums
sum_bad_XXth = sum_over_patterns(bad_XXth_data, new_name='badth')

# Sum of good and bad
sum_bad_XXth_and_11th = sum_over_patterns(only_11th.merge(bad_XXth_data,
                                                          on='year'),
                                          new_name='allth')
sum_bad_XXth_and_11th_medians = median_over_months(sum_bad_XXth_and_11th)
sum_bad_XXth_and_11th_medians_smooth = smooth_data(
    sum_bad_XXth_and_11th_medians, 5)

# Difference between good and sum of bad and good (not necessarily equal to sum of bad alone)
# -*- coding: utf-8 -*-
"""
@author: David R Hagen
@license: MIT
"""

from general_setup import merge_data,smooth_data,median_over_months,sum_over_patterns,filter_for_specific_day,plot_me
from load_data import good_XXth_data,old_style_data

# Good medians
good_XXth_medians = median_over_months(good_XXth_data)
good_XXth_medians_smooth = smooth_data(good_XXth_medians, 5)

# Old-style medians
old_style_medians = median_over_months(old_style_data)
old_style_medians_smooth = smooth_data(old_style_medians)

# Extract new-style days
only_2nd = filter_for_specific_day(good_XXth_data, '2nd')
only_3rd = filter_for_specific_day(good_XXth_data, '3rd')
only_22nd = filter_for_specific_day(good_XXth_data, '22nd')
only_23rd = filter_for_specific_day(good_XXth_data, '23rd')

# Extract old-style days
only_2d = filter_for_specific_day(old_style_data, '2d')
only_3d = filter_for_specific_day(old_style_data, '3d')
only_22d = filter_for_specific_day(old_style_data, '22d')
only_23d = filter_for_specific_day(old_style_data, '23d')

# Sum old and new style
sum_2nd_2d = sum_over_patterns(only_2nd.merge(only_2d, on='year'), new_name='2xx')
示例#4
0
# -*- coding: utf-8 -*-
"""
@author: David R Hagen
@license: MIT
"""

from general_setup import merge_data, smooth_data, median_over_months, sum_over_patterns, filter_for_specific_day, plot_me
from load_data import good_XXth_data, old_style_data

# Good medians
good_XXth_medians = median_over_months(good_XXth_data)
good_XXth_medians_smooth = smooth_data(good_XXth_medians, 5)

# Old-style medians
old_style_medians = median_over_months(old_style_data)
old_style_medians_smooth = smooth_data(old_style_medians)

# Extract new-style days
only_2nd = filter_for_specific_day(good_XXth_data, '2nd')
only_3rd = filter_for_specific_day(good_XXth_data, '3rd')
only_22nd = filter_for_specific_day(good_XXth_data, '22nd')
only_23rd = filter_for_specific_day(good_XXth_data, '23rd')

# Extract old-style days
only_2d = filter_for_specific_day(old_style_data, '2d')
only_3d = filter_for_specific_day(old_style_data, '3d')
only_22d = filter_for_specific_day(old_style_data, '22d')
only_23d = filter_for_specific_day(old_style_data, '23d')

# Sum old and new style
sum_2nd_2d = sum_over_patterns(only_2nd.merge(only_2d, on='year'),