Adapted from pandas.tseries.index.DatetimeIndex.get_loc
353469
def get_loc(self, key, method=None, tolerance=None):
        """"""
        if isinstance(key, str):
            return self._get_string_slice(key)
        else:
            return pd.Index.get_loc(self, key, method=method,
                                    tolerance=tolerance)
1323075
def from_pandas(cls, index):
        
        from pandas import Index as PandasIndex
        check_type(index, PandasIndex)

        return Index(index.values,
                     index.dtype,
                     index.name)
688925
def _get_processed_dataframe(self, dataframe):
        
        dataframe.index = pd.to_datetime(dataframe['epoch'], unit='s', utc=True)
        del dataframe['epoch']
        summary = dataframe.describe(percentiles=[.80, .90, .95]).transpose().loc['scriptrun_time']
        df_grp = dataframe.groupby(pd.TimeGrouper('{}S'.format(self.interval)))
        df_final = df_grp.apply(lambda x: x.describe(percentiles=[.80, .90, .95])['scriptrun_time'])

        return {
            "raw": dataframe.round(2),
            "compiled": df_final.round(2),
            "summary": summary.round(2)
        }
28499
def loc(lexer: Lexer, start_token: Token) -> Optional[Location]:
    
    if not lexer.no_location:
        end_token = lexer.last_token
        source = lexer.source
        return Location(
            start_token.start, end_token.end, start_token, end_token, source
        )
    return None
135118
def get_dtype_counts(self):
        
        if hasattr(self, "dtype"):
            return pandas.Series({str(self.dtype): 1})
        result = self.dtypes.value_counts()
        result.index = result.index.map(lambda x: str(x))
        return result
186322
def indices(self):
        """"""
        self._prep_pandas_groupby()

        def extract_group_indices(frame):
            return (frame[0], frame[1].index)

        return self._mergedRDD.map(extract_group_indices).collectAsMap()
763755
def decode_timeseries_row(self, tsrow, tscols=None,
                              convert_timestamp=False):
        
        row = []
        for i, cell in enumerate(tsrow.cells):
            col = None
            if tscols is not None:
                col = tscols[i]
            if cell.HasField('varchar_value'):
                if col and not (col.type == TsColumnType.Value('VARCHAR') or
                                col.type == TsColumnType.Value('BLOB')):
                    raise TypeError('expected VARCHAR or BLOB column')
                else:
                    row.append(cell.varchar_value)
            elif cell.HasField('sint64_value'):
                if col and col.type != TsColumnType.Value('SINT64'):
                    raise TypeError('expected SINT64 column')
                else:
                    row.append(cell.sint64_value)
            elif cell.HasField('double_value'):
                if col and col.type != TsColumnType.Value('DOUBLE'):
                    raise TypeError('expected DOUBLE column')
                else:
                    row.append(cell.double_value)
            elif cell.HasField('timestamp_value'):
                if col and col.type != TsColumnType.Value('TIMESTAMP'):
                    raise TypeError('expected TIMESTAMP column')
                else:
                    dt = cell.timestamp_value
                    if convert_timestamp:
                        dt = datetime_from_unix_time_millis(
                            cell.timestamp_value)
                    row.append(dt)
            elif cell.HasField('boolean_value'):
                if col and col.type != TsColumnType.Value('BOOLEAN'):
                    raise TypeError('expected BOOLEAN column')
                else:
                    row.append(cell.boolean_value)
            else:
                row.append(None)
        return row
942348
def tcounts(self):
        
        df = pd.DataFrame([[t.name(), t.size()] for t in self.tables()], columns=["name", "size"])
        df.index = df.name
        return df
188012
def one_version(self, index=0):
        '''
        
        '''
        def prep(df):
            start = sorted(df._start.tolist())[index]
            return df[df._start == start]

        return pd.concat([prep(df) for _, df in self.groupby(self._oid)])
166355
def with_index(self, new_index):
        
        return TimeSeriesRDD(None, None, self._jtsrdd.withIndex(new_index._jdt_index), self.ctx)
542126
def _get_series_result_type(result, objs=None):
    
    from pandas import SparseSeries, SparseDataFrame, DataFrame

    # concat Series with axis 1
    if isinstance(result, dict):
        # concat Series with axis 1
        if all(isinstance(c, (SparseSeries, SparseDataFrame))
               for c in result.values()):
            return SparseDataFrame
        else:
            return DataFrame

    # otherwise it is a SingleBlockManager (axis = 0)
    if result._block.is_sparse:
        return SparseSeries
    else:
        return objs[0]._constructor
1224930
def get_deviations(self):
        

        mean_vec = self.mean()

        df = self.loc[:,:].copy()
        for col in df.columns:
            df.loc[:,col] -= mean_vec[col]
        return type(self).from_dataframe(pst=self.pst,df=df)
388171
def loc(parser, start):
    # type: (Parser, int) -> Optional[Loc]
    """"""
    if parser.options["no_location"]:
        return None

    if parser.options["no_source"]:
        return Loc(start, parser.prev_end)

    return Loc(start, parser.prev_end, parser.source)
72815
def load(self):
        
        try:
            return self._load.loc[[self.timeindex], :]
        except:
            return self._load.loc[self.timeindex, :]
82893
def _extract_time_loc(self, term):
        """"""
        loc = term.find('location')
        if loc is None:
            loc_context = None
        else:
            loc_id = loc.attrib.get('id')
            loc_term = self.tree.find("*[@id='%s']" % loc_id)
            text = loc_term.findtext('text')
            name = loc_term.findtext('name')
            loc_context = RefContext(name=text)
        time = term.find('time')
        if time is None:
            time_context = None
        else:
            time_id = time.attrib.get('id')
            time_term = self.tree.find("*[@id='%s']" % time_id)
            if time_term is not None:
                text = time_term.findtext('text')
                timex = time_term.find('timex')
                if timex is not None:
                    year = timex.findtext('year')
                    try:
                        year = int(year)
                    except Exception:
                        year = None
                    month = timex.findtext('month')
                    day = timex.findtext('day')
                    if year and (month or day):
                        try:
                            month = int(month)
                        except Exception:
                            month = 1
                        try:
                            day = int(day)
                        except Exception:
                            day = 1
                        start = datetime(year, month, day)
                        time_context = TimeContext(text=text, start=start)
                    else:
                        time_context = TimeContext(text=text)
                else:
                    time_context = TimeContext(text=text)
            else:
                time_context = None
        return time_context, loc_context
520718
def location(self):
        
        if not hasattr(self, '_loc'):
            self._loc = conf.lib.clang_getCursorLocation(self)

        return self._loc
593782
def get_nan_locs(self, **kwargs):
        
        if np.issubdtype(self.X.dtype, np.string_) or np.issubdtype(self.X.dtype, np.unicode_):
            mask = np.where( self.X == '' )
            nan_matrix = np.zeros(self.X.shape)
            nan_matrix[mask] = np.nan

        else:
            nan_matrix = self.X.astype(float)

        if self.y is None:
            return np.argwhere(np.isnan(nan_matrix))
        else:
            nan_locs = []
            for target_value in np.unique(self.y):
                indices = np.argwhere(self.y == target_value)
                target_matrix = nan_matrix[indices.flatten()]
                nan_target_locs = np.argwhere(np.isnan(target_matrix))
                nan_locs.append((target_value, nan_target_locs))

            return nan_locs