Returns categories for the specified numeric values

        Args:
            column(pandas.Series): Values to transform into categories

        Returns:
            pandas.Series
553305
def get_category(self, column):
        
        result = pd.Series(index=column.index)

        for category, stats in self.probability_map.items():
            start, end = stats[0]
            result[(start < column) & (column < end)] = category

        return result
48526
def iter_series(self, workbook, row, col):
        
        for series in self.__series:
            series = dict(series)
            series["values"] = series["values"].get_formula(workbook, row, col)
            if "categories" in series:
                series["categories"] = series["categories"].get_formula(workbook, row, col)
            yield series
335643
def series2df(Series, layer=2, split_sign = '_'):
    """"""
    try:
        Series.columns
        Series = Series.iloc[:,0]
    except:
        pass
    
    def _helper(x, layer=2):
        try:
            return flatten_dict(ast.literal_eval(x), layers=layer, split_sign=split_sign)
        except:
            try:
                return flatten_dict(x, layers=layer, split_sign=split_sign)
            except:
                return x
    
    df=pd.DataFrame(Series.apply(_helper).tolist())
    
    return df
623466
def indexcol(self, col: str):
        
        try:
            self.df[col] = self.df.index.values
        except Exception as e:
            self.err(e)
            return
        self.ok("Column", col, "added from the index")
1058751
def _get_column_type(self,column):
        
        ctype = column.GetType()
        if ctype in [ogr.OFTInteger, ogr.OFTReal]:
            return 'numeric'
        else:
            return 'string'
135369
def values_for_column(self,
                          column_name,
                          limit=10000):
        """"""
        logging.info(
            'Getting values for columns [{}] limited to [{}]'
            .format(column_name, limit))
        # TODO: Use Lexicographic TopNMetricSpec once supported by PyDruid
        if self.fetch_values_from:
            from_dttm = utils.parse_human_datetime(self.fetch_values_from)
        else:
            from_dttm = datetime(1970, 1, 1)

        qry = dict(
            datasource=self.datasource_name,
            granularity='all',
            intervals=from_dttm.isoformat() + '/' + datetime.now().isoformat(),
            aggregations=dict(count=count('count')),
            dimension=column_name,
            metric='count',
            threshold=limit,
        )

        client = self.cluster.get_pydruid_client()
        client.topn(**qry)
        df = client.export_pandas()
        return [row[column_name] for row in df.to_records(index=False)]
1143894
def exact(self, column, *values):
        
        df = self._exact(column, *values)
        if df is None:
            self.err("Can not select exact data")
        self.df = df
509555
def _get_unique_categories(self, df):
        """"""

        categories = []
        for col in self._categorical_columns:
            categocial = pd.Categorical(df[col])
            col_categories = list(map(str, categocial.categories))
            col_categories.append('_UNKNOWN')
            categories.append(col_categories)
        return categories
187900
def get_column(self, column):
		
		if column.lower() == 'q':
			return self.get_q
		else:
			return self.getColumnByName(column).asarray()
1170730
def index(self, column):  # pylint: disable=C6409
        
        for i, key in enumerate(self._keys):
            if key == column:
                return i
        raise ValueError('Column "%s" not found.' % column)
819851
def columns_classes(self):
        ''''''
        md = 12 / self.objects_per_row
        sm = None
        if self.objects_per_row > 2:
            sm = 12 / (self.objects_per_row / 2)
        return md, (sm or md), 12
112422
def _get_gtf_column(column_name, gtf_path, df):
    
    if column_name in df.columns:
        return list(df[column_name])

    else:
        raise ValueError(
            "Missing '%s' in columns of %s, available: %s" % (
                column_name,
                gtf_path,
                list(df.columns)))
159440
def as_categorical(self):
        
        if len(self.shape) > 1:
            raise ValueError("Can't convert a 2D array to a categorical.")

        with ignore_pandas_nan_categorical_warning():
            return pd.Categorical.from_codes(
                self.as_int_array(),
                # We need to make a copy because pandas >= 0.17 fails if this
                # buffer isn't writeable.
                self.categories.copy(),
                ordered=False,
            )
1125056
def get_ftype_counts(self):
        
        if hasattr(self, "ftype"):
            return pandas.Series({self.ftype: 1})
        return self.ftypes.value_counts().sort_index()
579284
def ncontains(self, column, value):
        
        df = self.df[self.df[column].str.contains(value) == False]
        if df is None:
            self.err("Can not select contained data")
            return
        self.df = df
474521
def lists(self, column, key=None):
        
        columns = self._get_list_select(column, key)

        if key is not None:
            results = {}
            for result in self.get(columns):
                results[result[key]] = result[column]
        else:
            results = Collection(list(map(lambda x: x[column], self.get(columns))))

        return results
1024801
def get_column(self, column):
        
        if "(" in str(column):
            temp_list = column.split("(")
            key = temp_list[1].strip("()")
            func = temp_list[0].lower()
        else:
            key = column
            func = None

        if "." not in key:
            for i in self.columns:
                if i.split(".")[1] == key:
                    key = i
                    break

        col = map(
            lambda x: x.get(
                key
            ),
            self.rows
        )

        if func is not None:
            if func == "sum":
                return [sum(col)]
            elif func == "max":
                return [max(col)]
            elif func == "min":
                return [min(col)]
            elif func == "avg":
                return [sum(col) / float(len(col))]
            elif func == "count":
                return [len(col)]
            elif func == "distinct":
                return list(set(col))
            else:
                raise Exception(
                    "Unknown function called on column"
                )

        return col