This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def monkey_patch_pandas(): | |
import pandas as pd | |
import functools | |
@functools.wraps(pd.Series.str.contains) | |
def _grep(self, *args, **kwargs): | |
if not hasattr(self, '_greppable'): | |
self._greppable = pd.Series(self.to_csv().split('\n')[1:-1]) | |
i = self._greppable.str.contains(*args, **kwargs) | |
return self.iloc[i.values] | |
pd.DataFrame.grep = _grep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dataclasses | |
import importlib | |
# begin serialization lib | |
import io | |
import json | |
import lzma | |
import pickle | |
from base64 import b64decode, b64encode | |
from types import FunctionType |
OlderNewer