Skip to content

util.testing.assert_almost_equal() gives Key Error  #11584

Closed
@dickster77

Description

@dickster77

Test 1 works successfully with a square dataframe

import numpy as np
import pandas as pd

np.random.seed(1)
a = pd.DataFrame(np.random.rand(5, 5))
np.random.seed(1)
b = pd.DataFrame(np.random.rand(5, 5))
b += 0.00001
pd.util.testing.assert_almost_equal(a,b)

Test 2 fails with a dataframe where number rows > number of columns

np.random.seed(1)
a = pd.DataFrame(np.random.rand(6, 5))
np.random.seed(1)
b = pd.DataFrame(np.random.rand(6, 5))
b += 0.00001
pd.util.testing.assert_almost_equal(a,b)

KeyError: 5L

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error ReportingIncorrect or improved errors from pandasTestingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions