Visitar URL original
[CP-3513] feat: lazy import pandas by rikbw · Pull Request #417 · datacamp/pythonwhat · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat: lazy import pandas
  • Loading branch information
rikbw committed Nov 27, 2024
commit c3bfa0411a52a2035e43cdc2061856537d5bf1db
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/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