lung-development-cancer-progression
lung-development-cancer-progression copied to clipboard
Error with GENERATE AXIS PER VIOLIN PLOT
Hello,
Your tutorial is a wonderful tool! I ran into an issue with following it.
code: fraction_cell_type_array = pd.DataFrame() for cell_index in np.arange(binary_heatmap_data.shape[0]): current_cell = binary_heatmap_data.ix[cell_index,:] detected_genes = current_cell[current_cell==1].index detected_cell_types = list(detected_genes.map(inverted_marker_genes_dict)) fraction_cell_type = pd.DataFrame(columns = ['Cell Type', 'Gene Counts']) for cell_type in np.unique(detected_cell_types): fraction_cell_type = fraction_cell_type.append({'Cell Type' :cell_type, 'Gene Counts': detected_cell_types.count(cell_type)}, ignore_index = True) fraction_cell_type = fraction_cell_type.set_index('Cell Type').T fraction_cell_type =fraction_cell_type.div(fraction_cell_type.sum(axis=1),axis=0) all_cell_types = ['AEC1','AEC2','AEP','BASAL','CILIATED','CLUB','NE'] missing_cell_types = [cell_type for cell_type in all_cell_types if cell_type not in list(fraction_cell_type.columns)] for missing_type in missing_cell_types: fraction_cell_type[missing_type]=0 fraction_cell_type = fraction_cell_type.sort_index(axis=1) fraction_cell_type_array = fraction_cell_type_array.append(fraction_cell_type) fraction_cell_type_array.index = binary_heatmap_data.index
Error:
TypeError Traceback (most recent call last)
~/anaconda3/envs/mlc/lib/python3.6/site-packages/pandas/indexes/base.py in map(self, mapper) 2439 applied : array 2440 """ -> 2441 return self._arrmap(self.values, mapper) 2442 2443 def isin(self, values, level=None):
pandas/src/algos_common_helper.pxi in pandas.algos.arrmap_object (pandas/algos.c:46681)()
TypeError: 'dict' object is not callable
My pandas is 0.19.2 I'm really at a loss as to how to proceed, and any guidance would be much appreciated! Thank you for your kind help!