Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP-3513] feat: lazy import pandas #417

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pythonwhat/Test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import re
import numpy as np
import pandas as pd
from pandas.testing import assert_frame_equal, assert_series_equal
from pythonwhat.tasks import *
from protowhat.Test import Test

Expand Down Expand Up @@ -111,6 +109,8 @@ def areinstance(x, y, tuple_of_classes):
# First try to the faster equality functions. If these don't pass,
# Run the assertions that are typically slower.
def is_equal(x, y):
import pandas as pd
from pandas.testing import assert_frame_equal, assert_series_equal
try:
if areinstance(x, y, (Exception,)):
# Types of errors don't matter (this is debatable)
Expand Down
2 changes: 1 addition & 1 deletion pythonwhat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "2.25.0"
__version__ = "2.26.0"

from .test_exercise import test_exercise, allow_errors
2 changes: 1 addition & 1 deletion pythonwhat/checks/check_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
)
from pythonwhat.checks.check_funcs import part_to_child
from pythonwhat.utils import v2_only
import pandas as pd
import ast


Expand Down Expand Up @@ -289,6 +288,7 @@ def check_df(state, index, missing_msg=None, not_instance_msg=None, expand_msg=N
my_df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]})

"""
import pandas as pd
child = check_object(
state,
index,
Expand Down