def find(self, tname, where=None, where_not=None, columns=None, astype=None):
        '''
        Find records in the provided table from the database. If no records are found, return empty
        list, str or dataframe depending on the value of `astype`.

        Parameters
        ----------
        tname : str
            Table to search records from.
        where : dict or None (default `None`)
            Dictionary of <column, value> where value can be of str type for exact match or a
            compiled regex expression for more advanced matching.
        where_not : dict or None (default `None`)
            Identical to `where` but for negative-matching.
        columns: list of str, str or None (default `None`)
            Column(s) to return for the found records, if any.
        astype: str, type or None (default `None`)
            Type to cast the output to. Possible values are: `nonetype`, `dataframe`, `str`,
            `dict`, `json`. If this is `None`, falls back to the type provided to the constructor.
            If a type was provided to the constructor but the user wants to avoid any casting,
            "nonetype" should be passed as the value.

        Returns
        -------
        records : str, list or dataframe
            Output type depends on `astype` parameter.

        Examples
        --------
        >>> db = PandasDatabase("test")
        >>> db.insert("test", record={"Name": "John"})
            Name                                      John
            __id__    dc876999-1f5b-4262-b6bf-c23b875f3a54
            dtype: object
        >>> db.find("test", astype="dict")
            [{'Name': 'John', '__id__': 'dc876999-1f5b-4262-b6bf-c23b875f3a54'}]
        >>> db.find("test", astype="dataframe")
                                             __id__  Name
            0  dc876999-1f5b-4262-b6bf-c23b875f3a54  John
        >>> db.find("test", astype=None)
                                             __id__  Name
            0  dc876999-1f5b-4262-b6bf-c23b875f3a54  John
        >>> db.find("test", where={"Name": "John"}, astype="dict")
            [{'Name': 'John', '__id__': 'dc876999-1f5b-4262-b6bf-c23b875f3a54'}]
        >>> db.find("test", where_not={"Name": "John"}, astype="dict")
            []
        '''
        try:
            # Find is inherently read-only so don't try to autoload table
            tname = self._check_tname(tname, noload=True)
        except ValueError:
            return self._output(DataFrame(), astype=astype)
        where = PandasDatabase._check_conditions(where)
        where_not = PandasDatabase._check_conditions(where_not)
        columns = PandasDatabase._check_type_iter(str, columns)

        dataframe = self._db[tname]
        if len(columns) > 0 and len(dataframe) > 0:
            dataframe = dataframe[columns]

        # Parse the conditions to match
        if len(where) > 0:
            dataframe = dataframe[self._get_condition_mask(dataframe, where)]

        # Parse the conditions not to match
        if len(where_not) > 0:
            dataframe = dataframe[~self._get_condition_mask(dataframe, where_not)]

        self._print('Found %d records in table "%s" where %r and where not %r'
                    % (len(dataframe), tname, where, where_not))
        return self._output(dataframe, astype=astype)
def find ( self , tname , where = None , where_not = None , columns = None , astype = None ) : try : tname = self . _check_tname ( tname , noload = True ) except ValueError : return self . _output ( DataFrame ( ) , astype = astype ) where = PandasDatabase . _check_conditions ( where ) where_not = PandasDatabase . _check_conditions ( where_not ) columns = PandasDatabase . _check_type_iter ( str , columns ) dataframe = self . _db [ tname ] if len ( columns ) > 0 and len ( dataframe ) > 0 : dataframe = dataframe [ columns ] if len ( where ) > 0 : dataframe = dataframe [ self . _get_condition_mask ( dataframe , where ) ] if len ( where_not ) > 0 : dataframe = dataframe [ ~ self . _get_condition_mask ( dataframe , where_not ) ] self . _print ( 'Found %d records in table "%s" where %r and where not %r' % ( len ( dataframe ) , tname , where , where_not ) ) return self . _output ( dataframe , astype = astype )
Find records in the provided table from the database. If no records are found, return empty
        list, str or dataframe depending on the value of `astype`.

        Parameters
        ----------
        tname : str
            Table to search records from.
        where : dict or None (default `None`)
            Dictionary of <column, value> where value can be of str type for exact match or a
            compiled regex expression for more advanced matching.
        where_not : dict or None (default `None`)
            Identical to `where` but for negative-matching.
        columns: list of str, str or None (default `None`)
            Column(s) to return for the found records, if any.
        astype: str, type or None (default `None`)
            Type to cast the output to. Possible values are: `nonetype`, `dataframe`, `str`,
            `dict`, `json`. If this is `None`, falls back to the type provided to the constructor.
            If a type was provided to the constructor but the user wants to avoid any casting,
            "nonetype" should be passed as the value.

        Returns
        -------
        records : str, list or dataframe
            Output type depends on `astype` parameter.

        Examples
        --------
        >>> db = PandasDatabase("test")
        >>> db.insert("test", record={"Name": "John"})
            Name                                      John
            __id__    dc876999-1f5b-4262-b6bf-c23b875f3a54
            dtype: object
        >>> db.find("test", astype="dict")
            [{'Name': 'John', '__id__': 'dc876999-1f5b-4262-b6bf-c23b875f3a54'}]
        >>> db.find("test", astype="dataframe")
                                             __id__  Name
            0  dc876999-1f5b-4262-b6bf-c23b875f3a54  John
        >>> db.find("test", astype=None)
                                             __id__  Name
            0  dc876999-1f5b-4262-b6bf-c23b875f3a54  John
        >>> db.find("test", where={"Name": "John"}, astype="dict")
            [{'Name': 'John', '__id__': 'dc876999-1f5b-4262-b6bf-c23b875f3a54'}]
        >>> db.find("test", where_not={"Name": "John"}, astype="dict")
            []