Skip to content

Commit

Permalink
Merge 180ce92 into caf6e3f
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmorrow committed Apr 15, 2019
2 parents caf6e3f + 180ce92 commit f3aac74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sci_analysis/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def determine_analysis_type(data, other=None, groups=None, labels=None, order=No
else:
return Vector(data, labels=labels)
else:
return Categorical(data, order=order, dropna=dropna)
return Categorical(data.astype(str), order=order, dropna=dropna)


def analyse(xdata, ydata=None, groups=None, labels=None, alpha=0.05, order=None, dropna=None, **kwargs):
Expand Down Expand Up @@ -277,11 +277,11 @@ def analyze(xdata, ydata=None, groups=None, labels=None, alpha=0.05, order=None,
),
distro,
)
parms = distro_class.fit(xdata)
fit = KSTest(xdata, distribution=distro, parms=parms, alpha=alpha, display=False)
parms = distro_class.fit(_data.data)
fit = KSTest(_data.data, distribution=distro, parms=parms, alpha=alpha, display=False)
tested.append('KSTest')
else:
fit = NormTest(xdata, alpha=alpha, display=False)
fit = NormTest(_data.data, alpha=alpha, display=False)
tested.append('NormTest')
GraphHisto(_data, mean=out_stats.mean, std_dev=out_stats.std_dev, **kwargs)
print(out_stats)
Expand All @@ -294,5 +294,5 @@ def analyze(xdata, ydata=None, groups=None, labels=None, alpha=0.05, order=None,

# Show the histogram and stats
GraphFrequency(_data, labels=labels, **kwargs)
CategoricalStatistics(xdata, **kwargs)
CategoricalStatistics(_data.data, **kwargs)
return tested if debug else None
9 changes: 9 additions & 0 deletions sci_analysis/test/test_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,15 @@ def test_145_categorical_with_grid(self):
save_to='{}test_analyze_145'.format(self.save_path)
), ['Frequencies'])

def test_146_categorical_from_bool_series(self):
input_array = pd.Series([True, False, True, False, True, False, False, True, True, True])
self.assertEqual(analyze(
input_array,
debug=True,
save_to='{}test_analyze_146'.format(self.save_path)
), ['Frequencies'])
self.assertEqual(input_array.dtype, bool)


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

0 comments on commit f3aac74

Please sign in to comment.