<commit_before># -*- coding: utf-8 -*-

try:
    from StringIO import StringIO
except:
    from io import StringIO

import os
import sys
import unittest
from textwrap import dedent

from numpy import nan
from numpy.random import randn
import numpy as np

from pandas import DataFrame, Series, Index
import pandas.core.format as fmt
import pandas.util.testing as tm
import pandas
import pandas as pd
from pandas.core.config import set_option,get_option

_frame = DataFrame(tm.getSeriesData())

def curpath():
    pth, _ = os.path.split(os.path.abspath(__file__))
    return pth

class TestDataFrameFormatting(unittest.TestCase):
    _multiprocess_can_split_ = True
    def setUp(self):
        self.frame = _frame.copy()

    def test_repr_embedded_ndarray(self):
        arr = np.empty(10, dtype=[('err', object)])
        for i in range(len(arr)):
            arr['err'][i] = np.random.randn(i)

        df = DataFrame(arr)
        repr(df['err'])
        repr(df)
        df.to_string()

    def test_eng_float_formatter(self):
        self.frame.ix[5] = 0

        fmt.set_eng_float_format()
        result = repr(self.frame)

        fmt.set_eng_float_format(use_eng_prefix=True)
        repr(self.frame)
<commit_msg>TST: ignore FutureWarning in core.format<commit_after># -*- coding: utf-8 -*-

try:
    from StringIO import StringIO
except:
    from io import StringIO

import os
import sys
import unittest
from textwrap import dedent

from numpy import nan
from numpy.random import randn
import numpy as np

from pandas import DataFrame, Series, Index
import pandas.core.format as fmt
import pandas.util.testing as tm
import pandas
import pandas as pd
from pandas.core.config import set_option,get_option

_frame = DataFrame(tm.getSeriesData())

def curpath():
    pth, _ = os.path.split(os.path.abspath(__file__))
    return pth

class TestDataFrameFormatting(unittest.TestCase):
    _multiprocess_can_split_ = True
    def setUp(self):
        import warnings
        self.frame = _frame.copy()
        warnings.filterwarnings('ignore',
                                category=FutureWarning,
                                module=".*format")

    def test_repr_embedded_ndarray(self):
        arr = np.empty(10, dtype=[('err', object)])
        for i in range(len(arr)):
            arr['err'][i] = np.random.randn(i)

        df = DataFrame(arr)
        repr(df['err'])
        repr(df)
        df.to_string()

    def test_eng_float_formatter(self):
        self.frame.ix[5] = 0

        fmt.set_eng_float_format()
        result = repr(self.frame)

        fmt.set_eng_float_format(use_eng_prefix=True)
        repr(self.frame)

{'fraction_non_alphanumeric': 0.09954579863739592, 'fraction_numerical': 0.003785011355034065, 'mean_word_length': 2.869692532942899, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3598124', 'n_tokens_mistral': 862, 'n_tokens_neox': 832, 'n_words': 211}