A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
class SyncAsyncDecoratorFactory: | |
""" | |
Factory creates decorator which can wrap either a coroutine or function. | |
To return something from wrapper use self._return | |
If you need to modify args or kwargs, you can yield them from wrapper | |
""" | |
def __new__(cls, *args, **kwargs): | |
instance = super().__new__(cls) | |
# This is for using decorator without parameters | |
if len(args) == 1 and not kwargs and (inspect.iscoroutinefunction(args[0]) or inspect.isfunction(args[0])): |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
``inspect_mate`` provides more methods to get information about class attribute | |
than the standard library ``inspect``. | |
This module is Python2/3 compatible, tested under Py2.7, 3.3, 3.4, 3.5, 3.6. | |
Includes tester function to check: |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)