When using the pandas library to interpret a dataset I am trying to sum up all the pairs across 2 columns of the dataframe by using value_counts(subset = ...). Unfortunately it keeps giving me spaces in the results that shouldn't be there and make the output unreadable. Anyone know how to avoid this?
Attempted:
clm = [ 'class', 'cap-shape', 'cap-surface', 'cap-color', 'bruises?', 'odor', 'gill-attachment', 'gill-spacing', 'gill-size', 'gill-color', 'stalk-shape', 'stalk-root', 'stalk-surface-above-ring', 'stalk-surface-below-ring', 'stalk-color-above-ring', 'stalk-color-below-ring', 'veil-type', 'veil-color', 'ring-number', 'ring-type', 'spore-print-color', 'population', 'habitat' ]
myTable = pd.read_csv(file_path, header=None, names=clm)
print(myTable.value_counts(subset = ['class', 'cap-color']))
Result:
There shouldn't be any blank spaces, each row should have a 'p' or an 'e'