Skip to content

Commit

Permalink
Addressed flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
drculhane committed Dec 31, 2024
1 parent ac9c597 commit 2f48349
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,24 +323,24 @@ def test_large_parquet_io(self,par_test_base_tmp,prob_size) :
with tempfile.TemporaryDirectory(dir=par_test_base_tmp) as tmp_dirname:
filename = f"{tmp_dirname}/pq_test_large_parquet"
size = 2**21 + 8 # A problem had been detected with parquet files of > 2**21 entries
bool_array = np.array((size//2)*[True,False]).tolist()
flt_array = np.arange(size).astype(np.float64).tolist()
int_array = np.arange(size).astype(np.int64).tolist()
str_array = np.array(["a"+str(i) for i in np.arange(size)]).tolist()
bool_array = np.array((size//2)*[True, False]).tolist()
flt_array = np.arange(size).astype(np.float64).tolist()
int_array = np.arange(size).astype(np.int64).tolist()
str_array = np.array(["a"+str(i) for i in np.arange(size)]).tolist()
arrays = [bool_array, int_array, flt_array, str_array]
tuples = list(zip(*arrays))
names = ['first','second','third','fourth']
index = pd.MultiIndex.from_tuples(tuples,names=names)
s = pd.Series(np.random.randn(size),index=index)
names = ['first', 'second', 'third', 'fourth']
index = pd.MultiIndex.from_tuples(tuples, names=names)
s = pd.Series(np.random.randn(size), index=index)
df = s.to_frame()
df.to_parquet(filename)
ak_df = ak.DataFrame(ak.read_parquet(filename))
ak_df = ak.DataFrame(ak.read_parquet(filename))
# This check is on all of the random numbers generated in s
assert np.all(ak_df.to_pandas().values[:,0] == s.values)
assert np.all(ak_df.to_pandas().values[:, 0] == s.values)
# This check is on all of the elements of the MultiIndex
for i in range(len(names)) :
assert np.all( df.index.get_level_values(names[i]).to_numpy() == ak_df[names[i]].to_ndarray() )
assert np.all(df.index.get_level_values(names[i]).to_numpy() == ak_df[names[i]].to_ndarray())


@pytest.mark.parametrize("dtype", NUMERIC_AND_STR_TYPES)
def test_get_datasets(self, par_test_base_tmp, dtype):
Expand Down

0 comments on commit 2f48349

Please sign in to comment.