Skip to content

Commit 73efcb4

Browse files
authored
Merge pull request #417 from datacamp/import-pandas-when-used
[CP-3513] feat: lazy import pandas
2 parents f2280ff + d0d0025 commit 73efcb4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

pythonwhat/Test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import re
22
import numpy as np
3-
import pandas as pd
4-
from pandas.testing import assert_frame_equal, assert_series_equal
53
from pythonwhat.tasks import *
64
from protowhat.Test import Test
75

@@ -111,6 +109,8 @@ def areinstance(x, y, tuple_of_classes):
111109
# First try to the faster equality functions. If these don't pass,
112110
# Run the assertions that are typically slower.
113111
def is_equal(x, y):
112+
import pandas as pd
113+
from pandas.testing import assert_frame_equal, assert_series_equal
114114
try:
115115
if areinstance(x, y, (Exception,)):
116116
# Types of errors don't matter (this is debatable)

pythonwhat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "2.25.0"
1+
__version__ = "2.26.0"
22

33
from .test_exercise import test_exercise, allow_errors

pythonwhat/checks/check_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
)
1414
from pythonwhat.checks.check_funcs import part_to_child
1515
from pythonwhat.utils import v2_only
16-
import pandas as pd
1716
import ast
1817

1918

@@ -289,6 +288,7 @@ def check_df(state, index, missing_msg=None, not_instance_msg=None, expand_msg=N
289288
my_df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]})
290289
291290
"""
291+
import pandas as pd
292292
child = check_object(
293293
state,
294294
index,

0 commit comments

Comments
 (0)