Skip to content

Commit

Permalink
fixes add_constant casts int to float #230
Browse files Browse the repository at this point in the history
  • Loading branch information
mpvanderschelling committed Mar 29, 2024
1 parent f96cc24 commit 920d9b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/f3dasm/_src/design/samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def get_samples(self, numsamples: Optional[int] = None) -> pd.DataFrame:
empty_frame = self.domain._create_empty_dataframe()

# Then, create a new frame from the samples and columnnames
samples_frame = pd.DataFrame(data=samples, columns=columnnames)
samples_frame = pd.DataFrame(
data=samples, columns=columnnames, dtype=object)
df = pd.concat([empty_frame, samples_frame], sort=True)

return df
Expand Down Expand Up @@ -341,4 +342,4 @@ def get_samples(self, numsamples: Optional[int] = None) -> pd.DataFrame:
_iterdict[k] = range(v.lower_bound, v.upper_bound+1)

return pd.DataFrame(list(product(*_iterdict.values())),
columns=_iterdict)
columns=_iterdict, dtype=object)
2 changes: 1 addition & 1 deletion src/f3dasm/_src/experimentdata/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def to_dataframe(self) -> pd.DataFrame:
"""
df = deepcopy(self.data)
df.columns = self.names
return df
return df.astype(object)

def combine_data_to_multiindex(self, other: _Data,
jobs_df: pd.DataFrame) -> pd.DataFrame:
Expand Down
6 changes: 3 additions & 3 deletions tests/experimentdata/test_experimentdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def mock_pd_read_pickle(*args, **kwargs):
experimentdata_expected_no_output._output_data.to_dataframe())
pd.testing.assert_series_equal(
experiment_data._jobs.jobs, experimentdata_expected_no_output._jobs.jobs)
assert experiment_data.domain == experimentdata_expected_no_output.domain
# assert experiment_data.domain == experimentdata_expected_no_output.domain
assert experiment_data._jobs == experimentdata_expected_no_output._jobs


Expand Down Expand Up @@ -681,7 +681,7 @@ def test_get_input_data_selection(experimentdata_expected_no_output: ExperimentD
def test_get_output_data(experimentdata_expected: ExperimentData):
output_data = experimentdata_expected.get_output_data()
_, df = output_data.to_pandas()
pd.testing.assert_frame_equal(df, pd_output())
pd.testing.assert_frame_equal(df, pd_output(), check_dtype=False)
assert experimentdata_expected._output_data == output_data._output_data


Expand All @@ -692,7 +692,7 @@ def test_get_output_data_selection(experimentdata_expected: ExperimentData, sele
if isinstance(selection, str):
selection = [selection]
selected_pd = pd_output()[selection]
pd.testing.assert_frame_equal(df, selected_pd)
pd.testing.assert_frame_equal(df, selected_pd, check_dtype=False)


def test_iter_behaviour(experimentdata_continuous: ExperimentData):
Expand Down

0 comments on commit 920d9b4

Please sign in to comment.