# Path: pyBN/utils/data.py
# def unique_bins(data):
# 	"""
# 	Get the unique values for each column in a dataset.
# 	"""
# 	bins = np.empty(len(data.T), dtype=np.int32)
# 	i = 0
# 	for col in data.T:
# 		bins[i] = len(np.unique(col))
# 		i+=1
# 	return bins


import numpy as np
from scipy import stats
from pyBN.utils.data import unique_bins
		- Compute ddof
		- Perfom one-way chisquare

	Arguments
	---------
	*data* : a nested numpy array
		The data from which to learn - must have at least three
		variables. All conditioned variables (i.e. Z) are compressed
		into one variable.

	Returns
	-------
	*chi2_statistic* : a float
		Chisquare statistic
	*p_val* : a float
		The pvalue from the chi2 and ddof

	Effects
	-------
	None

	Notes
	-----
	- Assuming for now that |Z| = 1... generalize later
	- Should generalize to let data be a Pandas DataFrame --> would
	encourage external use.

	"""
	# compress extra Z variables at the start.. not implemented yet
	#bins = np.amax(data, axis=0)+1

# Path: pyBN/utils/data.py
# def unique_bins(data):
# 	"""
# 	Get the unique values for each column in a dataset.
# 	"""
# 	bins = np.empty(len(data.T), dtype=np.int32)
# 	i = 0
# 	for col in data.T:
# 		bins[i] = len(np.unique(col))
# 		i+=1
# 	return bins


# Path: pyBN/utils/independence_tests.py
import numpy as np
from scipy import stats
from pyBN.utils.data import unique_bins

		- Compute ddof
		- Perfom one-way chisquare

	Arguments
	---------
	*data* : a nested numpy array
		The data from which to learn - must have at least three
		variables. All conditioned variables (i.e. Z) are compressed
		into one variable.

	Returns
	-------
	*chi2_statistic* : a float
		Chisquare statistic
	*p_val* : a float
		The pvalue from the chi2 and ddof

	Effects
	-------
	None

	Notes
	-----
	- Assuming for now that |Z| = 1... generalize later
	- Should generalize to let data be a Pandas DataFrame --> would
	encourage external use.

	"""
	# compress extra Z variables at the start.. not implemented yet
	#bins = np.amax(data, axis=0)+1

	bins = unique_bins(data)