Beispiel #1
0
use_numexpr_doc = """
: bool
    Use the numexpr library to accelerate computation if it is installed,
    the default is True
    Valid values: False,True
"""


def use_numexpr_cb(key):
    from pandas.core.computation import expressions

    expressions.set_use_numexpr(cf.get_option(key))


with cf.config_prefix("compute"):
    cf.register_option(
        "use_bottleneck",
        True,
        use_bottleneck_doc,
        validator=is_bool,
        cb=use_bottleneck_cb,
    )
    cf.register_option("use_numexpr",
                       True,
                       use_numexpr_doc,
                       validator=is_bool,
                       cb=use_numexpr_cb)
#
# options from the "display" namespace
Beispiel #2
0

use_numexpr_doc = """
: bool
    Use the numexpr library to accelerate computation if it is installed,
    the default is True
    Valid values: False,True
"""


def use_numexpr_cb(key):
    from pandas.core.computation import expressions
    expressions.set_use_numexpr(cf.get_option(key))


with cf.config_prefix('compute'):
    cf.register_option('use_bottleneck',
                       True,
                       use_bottleneck_doc,
                       validator=is_bool,
                       cb=use_bottleneck_cb)
    cf.register_option('use_numexpr',
                       True,
                       use_numexpr_doc,
                       validator=is_bool,
                       cb=use_numexpr_cb)
#
# options from the "display" namespace

pc_precision_doc = """
: int
Beispiel #3
0
"""
config for datetime formatting
"""
from pandas._config import config as cf

pc_date_dayfirst_doc = """
: boolean
    When True, prints and parses dates with the day first, eg 20/01/2005
"""

pc_date_yearfirst_doc = """
: boolean
    When True, prints and parses dates with the year first, eg 2005/01/20
"""

with cf.config_prefix('display'):
    # Needed upstream of `_libs` because these are used in tslibs.parsing
    cf.register_option('date_dayfirst', False, pc_date_dayfirst_doc,
                       validator=cf.is_bool)
    cf.register_option('date_yearfirst', False, pc_date_yearfirst_doc,
                       validator=cf.is_bool)
Beispiel #4
0
"""
config for datetime formatting
"""
from __future__ import annotations

from pandas._config import config as cf

pc_date_dayfirst_doc = """
: boolean
    When True, prints and parses dates with the day first, eg 20/01/2005
"""

pc_date_yearfirst_doc = """
: boolean
    When True, prints and parses dates with the year first, eg 2005/01/20
"""

with cf.config_prefix("display"):
    # Needed upstream of `_libs` because these are used in tslibs.parsing
    cf.register_option("date_dayfirst",
                       False,
                       pc_date_dayfirst_doc,
                       validator=cf.is_bool)
    cf.register_option("date_yearfirst",
                       False,
                       pc_date_yearfirst_doc,
                       validator=cf.is_bool)
Beispiel #5
0
    # try again for something better
    if not encoding or 'ascii' in encoding.lower():
        try:
            encoding = locale.getpreferredencoding()
        except Exception:
            pass

    # when all else fails. this will usually be "ascii"
    if not encoding or 'ascii' in encoding.lower():
        encoding = sys.getdefaultencoding()

    # GH#3360, save the reported defencoding at import time
    # MPL backends may change it. Make available for debugging.
    if not _initial_defencoding:
        _initial_defencoding = sys.getdefaultencoding()

    return encoding


pc_encoding_doc = """
: str/unicode
    Defaults to the detected encoding of the console.
    Specifies the encoding to be used for strings returned by to_string,
    these are generally strings meant to be displayed on the console.
"""

with cf.config_prefix('display'):
    cf.register_option('encoding', detect_console_encoding(), pc_encoding_doc,
                       validator=cf.is_text)
Beispiel #6
0

use_numexpr_doc = """
: bool
    Use the numexpr library to accelerate computation if it is installed,
    the default is True
    Valid values: False,True
"""


def use_numexpr_cb(key):
    from pandas.core.computation import expressions
    expressions.set_use_numexpr(cf.get_option(key))


with cf.config_prefix('compute'):
    cf.register_option('use_bottleneck', True, use_bottleneck_doc,
                       validator=is_bool, cb=use_bottleneck_cb)
    cf.register_option('use_numexpr', True, use_numexpr_doc,
                       validator=is_bool, cb=use_numexpr_cb)
#
# options from the "display" namespace

pc_precision_doc = """
: int
    Floating point output precision (number of significant digits). This is
    only a suggestion
"""

pc_colspace_doc = """
: int