We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1636eda commit 0a03625Copy full SHA for 0a03625
1 file changed
src/nuclearmasses/mass_table.py
@@ -39,9 +39,14 @@ def add_user_data(
39
# One via code: DataSource to differentiate from the original table data
40
required_columns = {"A", "Z", "DataSource"}
41
42
- # Convert a string into a type read_json can read
+ # Is the string a json string or filename
43
if isinstance(data, str):
44
- data = io.StringIO(data)
+ path = pathlib.Path(data)
45
+
46
+ if path.is_file():
47
+ data = path
48
+ else:
49
+ data = io.StringIO(data)
50
51
# Read the file, should be valid json so nice and simple
52
user_df: pd.DataFrame = pd.read_json(data, dtype={"A": int, "Z": int})
0 commit comments