Skip to content

Commit

Permalink
Ignore warnings when importing pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
rmjarvis committed Oct 15, 2023
1 parent d277ff2 commit e1a7099
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions galsim/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import numpy as np
import numbers
import warnings

from . import _galsim
from ._utilities import lazy_property, basestring
Expand Down Expand Up @@ -464,8 +465,10 @@ def from_file(cls, file_name, interpolant='spline', x_log=False, f_log=False, am
ParserError = AttributeError # In case we don't get to the line below where we import
# it from pandas.
try:
import pandas
from pandas.errors import ParserError
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import pandas
from pandas.errors import ParserError
data = pandas.read_csv(file_name, comment='#', delim_whitespace=True, header=None)
data = data.values.transpose()
except (ImportError, AttributeError, ParserError):
Expand Down

0 comments on commit e1a7099

Please sign in to comment.