Search is not available for this dataset
repo_id stringlengths 12 110 | file_path stringlengths 24 164 | content stringlengths 3 89.3M | __index_level_0__ int64 0 0 |
|---|---|---|---|
public_repos/pandas/pandas/tests/io/formats/data | public_repos/pandas/pandas/tests/io/formats/data/html/gh13828_expected_output.html | <table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Group</th>
<th>Data</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>A</td>
<td>1.22</td>
</tr>
<tr>
<th>1</th>
<td>A</td>
<td>{na_rep}</td>
</tr>... | 0 |
public_repos/pandas/pandas/tests/io/formats/data | public_repos/pandas/pandas/tests/io/formats/data/html/multiindex_sparsify_2.html | <table border="1" class="dataframe">
<thead>
<tr>
<th></th>
<th>foo</th>
<th>0</th>
<th>1</th>
</tr>
<tr>
<th></th>
<th></th>
<th>0</th>
<th>0</th>
</tr>
<tr>
<th>foo</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<... | 0 |
public_repos/pandas/pandas/tests/io/formats/data | public_repos/pandas/pandas/tests/io/formats/data/html/trunc_df_index_named_standard_columns_named_multi.html | <table border="1" class="dataframe">
<thead>
<tr>
<th>foo</th>
<th colspan="2" halign="left">a</th>
<th>...</th>
<th colspan="2" halign="left">b</th>
</tr>
<tr>
<th></th>
<th colspan="2" halign="left">c</th>
<th>...</th>
<th colspan="2" halign="left">d</th>
... | 0 |
public_repos/pandas/pandas/tests/io/formats/data | public_repos/pandas/pandas/tests/io/formats/data/html/gh40024_expected_output.html | <table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>x</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>1,000</td>
</tr>
<tr>
<th>1</th>
<td>test</td>
</tr>
</tbody>
</table>
| 0 |
public_repos/pandas/pandas/tests/io/formats/data | public_repos/pandas/pandas/tests/io/formats/data/html/datetime64_monthformatter.html | <table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>months</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>2016-01</td>
</tr>
<tr>
<th>1</th>
<td>2016-02</td>
</tr>
</tbody>
</table>
| 0 |
public_repos/pandas/pandas/tests/io/formats/data | public_repos/pandas/pandas/tests/io/formats/data/html/unicode_2.html | <table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>σ</td>
</tr>
</tbody>
</table>
| 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_to_string.py | from textwrap import dedent
import pytest
from pandas import DataFrame
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
@pytest.fixture
def df():
return DataFrame({"A": [0, 1], "B": [-0.61, -1.22], "C": ["ab", "cd"]})
@pytest.fixture
def styler(df):
return Styler(df, uuid_len=0, p... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_non_unique.py | from textwrap import dedent
import pytest
from pandas import (
DataFrame,
IndexSlice,
)
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
@pytest.fixture
def df():
return DataFrame(
[[1, 2, 3], [4, 5, 6], [7, 8, 9]],
index=["i", "j", "j"],
columns=["c", "... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_matplotlib.py | import gc
import numpy as np
import pytest
from pandas import (
DataFrame,
IndexSlice,
Series,
)
pytest.importorskip("matplotlib")
pytest.importorskip("jinja2")
import matplotlib as mpl
from pandas.io.formats.style import Styler
@pytest.fixture(autouse=True)
def mpl_cleanup():
# matplotlib/testin... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_tooltip.py | import numpy as np
import pytest
from pandas import DataFrame
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
@pytest.fixture
def df():
return DataFrame(
data=[[0, 1, 2], [3, 4, 5], [6, 7, 8]],
columns=["A", "B", "C"],
index=["x", "y", "z"],
)
@pytest.fixtu... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_format.py | import numpy as np
import pytest
from pandas import (
NA,
DataFrame,
IndexSlice,
MultiIndex,
NaT,
Timestamp,
option_context,
)
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
from pandas.io.formats.style_render import _str_escape
@pytest.fixture
def df():
ret... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_style.py | import contextlib
import copy
import re
from textwrap import dedent
import numpy as np
import pytest
from pandas import (
DataFrame,
IndexSlice,
MultiIndex,
Series,
option_context,
)
import pandas._testing as tm
jinja2 = pytest.importorskip("jinja2")
from pandas.io.formats.style import ( # isort... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_highlight.py | import numpy as np
import pytest
from pandas import (
NA,
DataFrame,
IndexSlice,
)
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
@pytest.fixture(params=[(None, "float64"), (NA, "Int64")])
def df(request):
# GH 45804
return DataFrame(
{"A": [0, np.nan, 10], "B"... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_html.py | from textwrap import (
dedent,
indent,
)
import numpy as np
import pytest
from pandas import (
DataFrame,
MultiIndex,
option_context,
)
jinja2 = pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
@pytest.fixture
def env():
loader = jinja2.PackageLoader("pandas", "io/fo... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_bar.py | import numpy as np
import pytest
from pandas import DataFrame
pytest.importorskip("jinja2")
def bar_grad(a=None, b=None, c=None, d=None):
"""Used in multiple tests to simplify formatting of expected result"""
ret = [("width", "10em")]
if all(x is None for x in [a, b, c, d]):
return ret
retur... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_exceptions.py | import pytest
jinja2 = pytest.importorskip("jinja2")
from pandas import (
DataFrame,
MultiIndex,
)
from pandas.io.formats.style import Styler
@pytest.fixture
def df():
return DataFrame(
data=[[0, -0.609], [1, -1.228]],
columns=["A", "B"],
index=["x", "y"],
)
@pytest.fixtur... | 0 |
public_repos/pandas/pandas/tests/io/formats | public_repos/pandas/pandas/tests/io/formats/style/test_to_latex.py | from textwrap import dedent
import numpy as np
import pytest
from pandas import (
DataFrame,
MultiIndex,
option_context,
)
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
from pandas.io.formats.style_render import (
_parse_latex_cell_styles,
_parse_latex_css_conversion,
... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/excel/test_openpyxl.py | import contextlib
from pathlib import Path
import re
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame
import pandas._testing as tm
from pandas.io.excel import (
ExcelWriter,
_OpenpyxlWriter,
)
from pandas.io.excel._openpyxl import OpenpyxlReader
openpyxl = pytest.importorski... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/excel/test_xlsxwriter.py | import contextlib
import pytest
from pandas import DataFrame
import pandas._testing as tm
from pandas.io.excel import ExcelWriter
xlsxwriter = pytest.importorskip("xlsxwriter")
pytestmark = pytest.mark.parametrize("ext", [".xlsx"])
def test_column_format(ext):
# Test that column formats are applied to cells.... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/excel/test_readers.py | from datetime import (
datetime,
time,
)
from functools import partial
from io import BytesIO
import os
from pathlib import Path
import platform
import re
from urllib.error import URLError
from zipfile import BadZipFile
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas ... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/excel/test_xlrd.py | import io
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.io.excel import ExcelFile
from pandas.io.excel._base import inspect_excel_format
xlrd = pytest.importorskip("xlrd")
@pytest.fixture(params=[".xls"])
def read_ext_xlrd(request):
"""
Valid extensions for ... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/excel/conftest.py | import pytest
import pandas._testing as tm
from pandas.io.parsers import read_csv
@pytest.fixture
def frame(float_frame):
"""
Returns the first ten items in fixture "float_frame".
"""
return float_frame[:10]
@pytest.fixture
def tsframe():
return tm.makeTimeDataFrame()[:5]
@pytest.fixture(par... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/excel/test_style.py | import contextlib
import time
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
read_excel,
)
import pandas._testing as tm
from pandas.io.excel import ExcelWriter
from pandas.io.formats.excel import ExcelFormatter
pytest.importorskip("jinja2")
# jinj... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/excel/test_odf.py | import functools
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
pytest.importorskip("odf")
@pytest.fixture(autouse=True)
def cd_and_set_engine(monkeypatch, datapath):
func = functools.partial(pd.read_excel, engine="odf")
monkeypatch.setattr(pd, "read_excel", func)
mon... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/excel/test_odswriter.py | from datetime import (
date,
datetime,
)
import re
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.io.excel import ExcelWriter
odf = pytest.importorskip("odf")
pytestmark = pytest.mark.parametrize("ext", [".ods"])
def test_write_append_mode_raises(ext):
msg = "Append mode i... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/excel/test_writers.py | from datetime import (
date,
datetime,
timedelta,
)
from functools import partial
from io import BytesIO
import os
import re
import numpy as np
import pytest
from pandas.compat._constants import PY310
from pandas.compat._optional import import_optional_dependency
import pandas.util._test_decorators as td
... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/sas/test_xport.py | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.io.sas.sasreader import read_sas
# CSV versions of test xpt files were obtained using the R foreign library
# Numbers in a SAS xport file are always float64, so need to convert
# before making comparisons.
def numeric_as... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/sas/test_sas7bdat.py | import contextlib
from datetime import datetime
import io
import os
from pathlib import Path
import dateutil.parser
import numpy as np
import pytest
from pandas.errors import EmptyDataError
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
@pytest.fixture
def dirpath(datapa... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/sas/test_byteswap.py | from hypothesis import (
assume,
example,
given,
strategies as st,
)
import numpy as np
import pytest
from pandas._libs.byteswap import (
read_double_with_byteswap,
read_float_with_byteswap,
read_uint16_with_byteswap,
read_uint32_with_byteswap,
read_uint64_with_byteswap,
)
import p... | 0 |
public_repos/pandas/pandas/tests/io | public_repos/pandas/pandas/tests/io/sas/test_sas.py | from io import StringIO
import pytest
from pandas import read_sas
import pandas._testing as tm
class TestSas:
def test_sas_buffer_format(self):
# see gh-14947
b = StringIO("")
msg = (
"If this is a buffer object rather than a string "
"name, you must specify a fo... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/test_sas7bdat_1.csv | Column1,Column2,Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10,Column11,Column12,Column13,Column14,Column15,Column16,Column17,Column18,Column19,Column20,Column21,Column22,Column23,Column24,Column25,Column26,Column27,Column28,Column29,Column30,Column31,Column32,Column33,Column34,Column35,Column36,Colum... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/datetime.csv | Date1,Date2,DateTime,DateTimeHi,Taiw
1677-09-22,1677-09-22,1677-09-21 00:12:44,1677-09-21 00:12:43.145225,1912-01-01
1960-01-01,1960-01-01,1960-01-01 00:00:00,1960-01-01 00:00:00.000000,1960-01-01
2016-02-29,2016-02-29,2016-02-29 23:59:59,2016-02-29 23:59:59.123456,2016-02-29
2262-04-11,2262-04-11,2262-04-11 23:47:16,2... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/productsales.csv | ACTUAL,PREDICT,COUNTRY,REGION,DIVISION,PRODTYPE,PRODUCT,QUARTER,YEAR,MONTH
925,850,CANADA,EAST,EDUCATION,FURNITURE,SOFA,1,1993,1993-01-01
999,297,CANADA,EAST,EDUCATION,FURNITURE,SOFA,1,1993,1993-02-01
608,846,CANADA,EAST,EDUCATION,FURNITURE,SOFA,1,1993,1993-03-01
642,533,CANADA,EAST,EDUCATION,FURNITURE,SOFA,2,1993,1993... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/DEMO_G.csv | "SEQN","SDDSRVYR","RIDSTATR","RIAGENDR","RIDAGEYR","RIDAGEMN","RIDRETH1","RIDRETH3","RIDEXMON","RIDEXAGY","RIDEXAGM","DMQMILIZ","DMQADFC","DMDBORN4","DMDCITZN","DMDYRSUS","DMDEDUC3","DMDEDUC2","DMDMARTL","RIDEXPRG","SIALANG","SIAPROXY","SIAINTRP","FIALANG","FIAPROXY","FIAINTRP","MIALANG","MIAPROXY","MIAINTRP","AIALANGA... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/paxraw_d_short.csv | SEQN,PAXSTAT,PAXCAL,PAXDAY,PAXN,PAXHOUR,PAXMINUT,PAXINTEN,PAXSTEP
31128,1,1,1,1,0,0,166,4
31128,1,1,1,2,0,1,27,0
31128,1,1,1,3,0,2,0,0
31128,1,1,1,4,0,3,276,4
31128,1,1,1,5,0,4,0,0
31128,1,1,1,6,0,5,0,0
31128,1,1,1,7,0,6,0,0
31128,1,1,1,8,0,7,0,0
31128,1,1,1,9,0,8,0,0
31128,1,1,1,10,0,9,0,0
31128,1,1,1,11,0,10,0,0
3112... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/SSHSV1_A.csv | "SEQN","SSXHE1"
3,2
8,1
9,2
22,1
23,2
30,1
39,2
49,1
67,1
74,2
75,2
76,1
78,2
109,1
110,1
128,2
139,2
140,1
144,1
154,2
159,2
180,2
182,1
185,2
202,1
203,1
212,2
214,1
224,2
226,2
227,2
231,2
246,2
251,2
252,2
278,2
299,1
306,2
311,2
336,1
338,2
343,1
347,2
348,2
349,2
356,2
362,1
378,1
379,2
384,1
390,2
394,1
404,1
41... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/DRXFCD_G.csv | "DRXFDCD","DRXFCSD","DRXFCLD"
1.1e+07,"MILK, HUMAN","Milk, human"
11100000,"MILK, NFS","Milk, NFS"
11111000,"MILK, COW'S, FLUID, WHOLE","Milk, cow's, fluid, whole"
11111100,"MILK, COW'S, FLUID, WHOLE, LOW SODIUM","Milk, cow's, fluid, whole, low-sodium"
11111150,"MILK, CALCIUM FORTIFIED, WHOLE, COW'S, FLUID","Milk, calc... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/test_sas7bdat_2.csv | Column1,Column2,Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10,Column11,Column12,Column13,Column14,Column15,Column16,Column17,Column18,Column19,Column20,Column21,Column22,Column23,Column24,Column25,Column26,Column27,Column28,Column29,Column30,Column31,Column32,Column33,Column34,Column35,Column36,Colum... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/airline.csv | YEAR,Y,W,R,L,K
1948.00000839,1.21399998665,0.243000000715,0.145400002599,1.41499996185,0.611999988556
1949.0000084,1.35399997234,0.259999990463,0.218099996448,1.38399994373,0.559000015259
1950.0,1.56900000572,0.277999997139,0.315699994564,1.38800001144,0.573000013828
1951.0,1.94799995422,0.29699999094,0.393999993801,1.... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/0x40controlbyte.csv | long_string_field1,long_string_field2,long_string_field3
00000000000000000000000000000000000000000000000000,11111111111111111111111111111111111111111111111111,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
| 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/many_columns.csv | DATASRC,PDDOCID,age,agegt89,ASSESSA,ASSESS1,ASSESS3,ASSESS4,ASSESS5,ASSESS6,ASSESS7,week,BECK,conf1,conf2,conf3,demo3,demo4,demo5,demo6,demo7,demo11a,demo11b,demo11c,demo11d,derm1b,derm2,derm3,derm4,derm5a,derm5b,derm7,derm7a,derm7b,derm8,derm9,ECG3,ecgrtxt,ecgrhr,ecgrpr,ecgrqrs,ecgrqrsaxis,ecgrqt,ecgrqtc,ecgrrep,ecgrt... | 0 |
public_repos/pandas/pandas/tests/io/sas | public_repos/pandas/pandas/tests/io/sas/data/test_12659.csv | yearmonth,useGpCo,useGpVi,useSpec,useUrge,caseGpCo,caseGpVi,caseSpec,caseUrge,expendGpCo,expendGpVi,expendSpec,expendUrge
201401,11,12,13,14,15,16,17,18,19,20,21,22
201402,11,12,13,14,15,16,17,18,19,20,21,22
201403,11,12,13,14,15,16,17,18,19,20,21,22
201404,11,12,13,14,15,16,17,18,19,20,21,22
201405,11,12,13,14,15,16,1... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_union_categoricals.py | import numpy as np
import pytest
from pandas.core.dtypes.concat import union_categoricals
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
Series,
)
import pandas._testing as tm
class TestUnionCategoricals:
@pytest.mark.parametrize(
"a, b, combined",
[
... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_pivot.py | from datetime import (
date,
datetime,
timedelta,
)
from itertools import product
import re
import numpy as np
import pytest
from pandas.errors import PerformanceWarning
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Grouper,
Index,
MultiIndex,
Series,
concat... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_cut.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
DatetimeIndex,
Index,
Interval,
IntervalIndex,
Series,
TimedeltaIndex,
Timestamp,
cut,
date_range,
interval_range,
isna,
qcut,
timedelta_range,
to_datetime,
... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_qcut.py | import os
import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DatetimeIndex,
Interval,
IntervalIndex,
NaT,
Series,
TimedeltaIndex,
Timestamp,
cut,
date_range,
isna,
qcut,
timedelta_range,
)
import pandas._testing as tm
from pandas.... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_get_dummies.py | import re
import unicodedata
import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer_dtype
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
DataFrame,
RangeIndex,
Series,
SparseDtype,
get_dummies,
)
import pandas._testing as tm
from pandas.... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_melt.py | import re
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
lreshape,
melt,
wide_to_long,
)
import pandas._testing as tm
@pytest.fixture
def df():
res = tm.makeTimeDataFrame()[:10]
res["id1"] = (res["A"] > 0).astype(np.int64)
res["id2"] = (res["B"] > 0)... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_crosstab.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
CategoricalDtype,
CategoricalIndex,
DataFrame,
Index,
MultiIndex,
Series,
crosstab,
)
import pandas._testing as tm
@pytest.fixture
def df():
df = DataFrame(
{
"A": [
"foo",
... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_from_dummies.py | import numpy as np
import pytest
from pandas import (
DataFrame,
Series,
from_dummies,
get_dummies,
)
import pandas._testing as tm
@pytest.fixture
def dummies_basic():
return DataFrame(
{
"col1_a": [1, 0, 1],
"col1_b": [0, 1, 0],
"col2_a": [0, 1, 0],
... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_pivot_multilevel.py | import numpy as np
import pytest
from pandas._libs import lib
import pandas as pd
from pandas import (
Index,
MultiIndex,
)
import pandas._testing as tm
@pytest.mark.parametrize(
"input_index, input_columns, input_values, "
"expected_values, expected_columns, expected_index",
[
(
... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/reshape/test_util.py | import numpy as np
import pytest
from pandas import (
Index,
date_range,
)
import pandas._testing as tm
from pandas.core.reshape.util import cartesian_product
class TestCartesianProduct:
def test_simple(self):
x, y = list("ABC"), [1, 22]
result1, result2 = cartesian_product([x, y])
... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/data/cut_data.csv | 1.001 0.994 0.9951 0.9956 0.9956 0.9951 0.9949 1.001 0.994 0.9938 0.9908 0.9947 0.992 0.9912 1.0002 0.9914 0.9928 0.9892 0.9917 0.9955 0.9892 0.9912 0.993 0.9937 0.9951 0.9955 0.993 0.9961 0.9914 0.9906 0.9974 0.9934 0.992 0.9939 0.9962 0.9905 0.9934 0.9906 0.9999 0.9999 0.9937 0.9937 0.9954 0.9934 0.9934 0.9931 0.994 ... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_empty.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
RangeIndex,
Series,
concat,
date_range,
)
import pandas._testing as tm
class TestEmptyConcat:
def test_handle_empty_objects(self, sort):
df = DataFrame(
np.random.default_rng(2).standard_n... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_sort.py | import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame
import pandas._testing as tm
class TestConcatSort:
def test_concat_sorts_columns(self, sort):
# GH-4588
df1 = DataFrame({"a": [1, 2], "b": [1, 2]}, columns=["b", "a"])
df2 = DataFrame({"a": [3, 4], "c": [5, ... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_append_common.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Index,
Series,
)
import pandas._testing as tm
@pytest.fixture(
params=list(
{
"bool": [True, False, True],
"int64": [1, 2, 3],
"float64": [1.1, np.nan, 3.3... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_index.py | from copy import deepcopy
import numpy as np
import pytest
from pandas.errors import PerformanceWarning
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
concat,
)
import pandas._testing as tm
class TestIndexConcat:
def test_concat_ignore_index(self, sort):
... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_datetimes.py | import datetime as dt
from datetime import datetime
import dateutil
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
Timestamp,
concat,
date_range,
to_timedelta,
)
import pandas._testing as tm
class Tes... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_dataframe.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
concat,
)
import pandas._testing as tm
class TestDataFrameConcat:
def test_concat_multiple_frames_dtypes(self):
# GH#2759
df1 = DataFrame(data=np.ones((10, 2)), columns=["foo", "bar... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_concat.py | from collections import (
abc,
deque,
)
from collections.abc import Iterator
from datetime import datetime
from decimal import Decimal
import numpy as np
import pytest
from pandas.errors import InvalidIndexError
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/conftest.py | import pytest
@pytest.fixture(params=[True, False])
def sort(request):
"""Boolean sort keyword for concat and DataFrame.append."""
return request.param
| 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_append.py | import datetime as dt
from itertools import combinations
import dateutil
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
Timestamp,
concat,
isna,
)
import pandas._testing as tm
class TestAppend:
def test_append(self, sort, float_frame):... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_series.py | import numpy as np
import pytest
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
concat,
date_range,
)
import pandas._testing as tm
class TestSeriesConcat:
def test_concat_series(self):
ts = tm.makeTimeSeries()
ts.name = "foo"
pieces ... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_invalid.py | from io import StringIO
import numpy as np
import pytest
from pandas import (
DataFrame,
concat,
read_csv,
)
import pandas._testing as tm
class TestInvalidConcat:
def test_concat_invalid(self):
# trying to concat a ndframe with a non-ndframe
df1 = tm.makeCustomDataframe(10, 2)
... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/concat/test_categorical.py | from datetime import datetime
import numpy as np
from pandas.core.dtypes.dtypes import CategoricalDtype
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Series,
)
import pandas._testing as tm
class TestCategoricalConcat:
def test_categorical_concat(self, sort):
# See GH 1017... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/merge/test_merge.py | from datetime import (
date,
datetime,
timedelta,
)
import re
import numpy as np
import pytest
from pandas.core.dtypes.common import is_object_dtype
from pandas.core.dtypes.dtypes import CategoricalDtype
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
DataFrame,
Da... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/merge/test_merge_cross.py | import pytest
from pandas import (
DataFrame,
Series,
)
import pandas._testing as tm
from pandas.core.reshape.merge import (
MergeError,
merge,
)
@pytest.mark.parametrize(
("input_col", "output_cols"), [("b", ["a", "b"]), ("a", ["a_x", "a_y"])]
)
def test_merge_cross(input_col, output_cols):
... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/merge/test_multi.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
RangeIndex,
Series,
Timestamp,
)
import pandas._testing as tm
from pandas.core.reshape.concat import concat
from pandas.core.reshape.merge import merge
@pytest.fixture
def left():
"""le... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/merge/test_merge_index_as_string.py | import numpy as np
import pytest
from pandas import DataFrame
import pandas._testing as tm
@pytest.fixture
def df1():
return DataFrame(
{
"outer": [1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4],
"inner": [1, 2, 3, 1, 2, 3, 4, 1, 2, 1, 2],
"v1": np.linspace(0, 1, 11),
}
... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/merge/test_merge_ordered.py | import re
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
merge_ordered,
)
import pandas._testing as tm
@pytest.fixture
def left():
return DataFrame({"key": ["a", "c", "e"], "lvalue": [1, 2.0, 3]})
@pytest.fixture
def right():
return DataFrame({"key": ["b", "c"... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/merge/test_join.py | import re
import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Index,
MultiIndex,
Series,
Timestamp,
concat,
merge,
)
import pandas._testing as tm
def get_test_data(ngroups=8, n=50):
unique_groups = list(range(ngroups))
arr = np.as... | 0 |
public_repos/pandas/pandas/tests/reshape | public_repos/pandas/pandas/tests/reshape/merge/test_merge_asof.py | import datetime
import numpy as np
import pytest
import pytz
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
Index,
Timedelta,
merge_asof,
to_datetime,
)
import pandas._testing as tm
from pandas.core.reshape.merge import MergeError
@pytest.fixture(params=["s", "ms... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_indexers.py | # Tests aimed at pandas.core.indexers
import numpy as np
import pytest
from pandas.core.indexers import (
is_scalar_indexer,
length_of_indexer,
validate_indices,
)
def test_length_of_indexer():
arr = np.zeros(4, dtype=bool)
arr[0] = 1
result = length_of_indexer(arr)
assert result == 1
d... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_iloc.py | """ test positional based indexing with iloc """
from datetime import datetime
import re
import numpy as np
import pytest
from pandas.errors import IndexingError
import pandas.util._test_decorators as td
from pandas import (
NA,
Categorical,
CategoricalDtype,
DataFrame,
Index,
Interval,
... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_chaining_and_caching.py | from string import ascii_letters
import numpy as np
import pytest
from pandas.errors import (
SettingWithCopyError,
SettingWithCopyWarning,
)
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,
Series,
Timestamp,
date_range,
option_context,
)
impo... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_check_indexer.py | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.api.indexers import check_array_indexer
@pytest.mark.parametrize(
"indexer, expected",
[
# integer
([1, 2], np.array([1, 2], dtype=np.intp)),
(np.array([1, 2], dtype="int64"), np.array([1, 2]... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/common.py | """ common utilities """
from __future__ import annotations
from typing import (
Any,
Literal,
)
def _mklbl(prefix: str, n: int):
return [f"{prefix}{i}" for i in range(n)]
def check_indexing_smoketest_or_raises(
obj,
method: Literal["iloc", "loc"],
key: Any,
axes: Literal[0, 1] | None =... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/conftest.py | import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
date_range,
)
@pytest.fixture
def series_ints():
return Series(np.random.default_rng(2).random(4), index=np.arange(0, 8, 2))
@pytest.fixture
def frame_ints():
return DataFrame(
np.random.... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_na_indexing.py | import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize(
"values, dtype",
[
([], "object"),
([1, 2, 3], "int64"),
([1.0, 2.0, 3.0], "float64"),
(["a", "b", "c"], "object"),
(["a", "b", "c"], "string"),
([1, 2, 3], "datetime64[ns]... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_partial.py | """
test setting *parts* of objects both positionally and label based
TODO: these should be split among the indexer tests
"""
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
Period,
Series,
Timestamp,
date_range,
period_range,
)
import pandas._t... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_coercion.py | from __future__ import annotations
from datetime import (
datetime,
timedelta,
)
import itertools
import numpy as np
import pytest
from pandas.compat import (
IS64,
is_platform_windows,
)
import pandas as pd
import pandas._testing as tm
##############################################################... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_scalar.py | """ test scalar indexing, including at and iat """
from datetime import (
datetime,
timedelta,
)
import itertools
import numpy as np
import pytest
from pandas import (
DataFrame,
Series,
Timedelta,
Timestamp,
date_range,
)
import pandas._testing as tm
def generate_indices(f, values=False... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_loc.py | """ test label based indexing with loc """
from collections import namedtuple
from datetime import (
date,
datetime,
time,
timedelta,
)
import re
from dateutil.tz import gettz
import numpy as np
import pytest
from pandas._libs import index as libindex
from pandas.errors import IndexingError
import pan... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_floats.py | import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
RangeIndex,
Series,
)
import pandas._testing as tm
def gen_obj(klass, index):
if klass is Series:
obj = Series(np.arange(len(index)), index=index)
else:
obj = DataFrame(
np.random.default_rng(2... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_indexing.py | """ test fancy indexing & misc """
import array
from datetime import datetime
import re
import weakref
import numpy as np
import pytest
from pandas.errors import IndexingError
from pandas.core.dtypes.common import (
is_float_dtype,
is_integer_dtype,
is_object_dtype,
)
import pandas as pd
from pandas im... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_at.py | from datetime import (
datetime,
timezone,
)
import numpy as np
import pytest
from pandas.errors import InvalidIndexError
from pandas import (
CategoricalDtype,
CategoricalIndex,
DataFrame,
DatetimeIndex,
MultiIndex,
Series,
Timestamp,
)
import pandas._testing as tm
def test_at_... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_datetime.py | import re
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestDatetimeIndex:
def test_get_loc_naive_dti_aware_str_deprecated(self):
# GH#46903
ts = Timestamp("20130101")._value
... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_categorical.py | import re
import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
CategoricalDtype,
CategoricalIndex,
DataFrame,
Index,
Interval,
Series,
Timedelta,
Timestamp,
)
import pandas._testing as tm
@pytest.fixture
def df():
return DataFrame(
{
... | 0 |
public_repos/pandas/pandas/tests | public_repos/pandas/pandas/tests/indexing/test_iat.py | import numpy as np
from pandas import (
DataFrame,
Series,
period_range,
)
import pandas._testing as tm
def test_iat(float_frame):
for i, row in enumerate(float_frame.index):
for j, col in enumerate(float_frame.columns):
result = float_frame.iat[i, j]
expected = float_... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/interval/test_interval_new.py | import re
import numpy as np
import pytest
from pandas.compat import IS64
from pandas import (
Index,
Interval,
IntervalIndex,
Series,
)
import pandas._testing as tm
class TestIntervalIndex:
@pytest.fixture
def series_with_interval_index(self):
return Series(np.arange(5), IntervalIn... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/interval/test_interval.py | import numpy as np
import pytest
from pandas._libs import index as libindex
from pandas.compat import IS64
import pandas as pd
from pandas import (
DataFrame,
IntervalIndex,
Series,
)
import pandas._testing as tm
class TestIntervalIndex:
@pytest.fixture
def series_with_interval_index(self):
... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/multiindex/test_setitem.py | import numpy as np
import pytest
from pandas.errors import SettingWithCopyError
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,
MultiIndex,
Series,
Timestamp,
date_range,
isna,
notna,
)
import pandas._testing as tm
def assert_equal(a, b):
... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/multiindex/test_multiindex.py | import numpy as np
import pytest
import pandas._libs.index as libindex
from pandas.errors import PerformanceWarning
import pandas as pd
from pandas import (
CategoricalDtype,
DataFrame,
Index,
MultiIndex,
Series,
)
import pandas._testing as tm
from pandas.core.arrays.boolean import BooleanDtype
... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/multiindex/test_iloc.py | import numpy as np
import pytest
from pandas import (
DataFrame,
MultiIndex,
Series,
)
import pandas._testing as tm
@pytest.fixture
def simple_multiindex_dataframe():
"""
Factory function to create simple 3 x 3 dataframe with
both columns and row MultiIndex using supplied data or
random d... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/multiindex/test_chaining_and_caching.py | import numpy as np
import pytest
from pandas._libs import index as libindex
from pandas.errors import SettingWithCopyError
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
MultiIndex,
Series,
)
import pandas._testing as tm
def test_detect_chained_assignment(using_copy_on_write, ... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/multiindex/test_getitem.py | import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
)
import pandas._testing as tm
from pandas.core.indexing import IndexingError
# ----------------------------------------------------------------------------
# test indexing of Series with multi-level Index
# --... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/multiindex/test_partial.py | import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
MultiIndex,
date_range,
to_datetime,
)
import pandas._testing as tm
class TestMultiIndexPartial:
def test_getitem_partial_int(self):
# GH 12416
# with single item
l1... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/multiindex/test_loc.py | import numpy as np
import pytest
from pandas.errors import (
IndexingError,
PerformanceWarning,
)
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
)
import pandas._testing as tm
@pytest.fixture
def single_level_multiindex():
"""single level MultiIndex"""
... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/multiindex/test_indexing_slow.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Series,
)
import pandas._testing as tm
@pytest.fixture
def m():
return 5
@pytest.fixture
def n():
return 100
@pytest.fixture
def cols():
return ["jim", "joe", "jolie", "joline", "jolia"]
@pytest.fixture
def... | 0 |
public_repos/pandas/pandas/tests/indexing | public_repos/pandas/pandas/tests/indexing/multiindex/test_slice.py | from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas.errors import UnsortedIndexError
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
Timestamp,
)
import pandas._testing as tm
from pandas.tests.indexing.common import _mk... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.