Skip to content

Conversation

@mmkekic
Copy link
Collaborator

@mmkekic mmkekic commented Apr 8, 2020

The PR adds option to flag tables columns to be indexed.

Copy link
Collaborator

@gonzaponte gonzaponte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I would like just one more test to be added.

from typing import Optional
from typing import Sequence

def _decode_df_to_str(df):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about decode_str_columns?

with pytest.warns(UserWarning, match='does not exist'):
load_dsts([good_file, wrong_file], group, node)

def test_load_dst_converts_from_bytest(ICDATADIR, fixed_dataframe):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_load_dst_converts_from_bytest(ICDATADIR, fixed_dataframe):
def test_load_dst_converts_from_bytes(ICDATADIR, fixed_dataframe):

small typo

@mmkekic mmkekic force-pushed the fix_pandas_to_pytables branch from cecbcc0 to eccc348 Compare April 10, 2020 14:30
@mmkekic mmkekic changed the title Fix pandas to pytables Index dataframes table Apr 10, 2020
@mmkekic mmkekic changed the title Index dataframes table Index dataframes tables Apr 10, 2020
@mmkekic mmkekic force-pushed the fix_pandas_to_pytables branch 2 times, most recently from b42e5be to 81e02d6 Compare April 10, 2020 16:27
Copy link
Collaborator

@gonzaponte gonzaponte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An improved version of the dataframe writer with table indexation. The writer is now renamed to df_writer, which is much more comfortable. This PR also includes the indexation of the event column in the output of Beersheva and Esmeralda.

This change suggests that we should ensure each city indexes its output properly, but that is left for a different PR.

The new feature is properly and thoughtfully tested. Nice job!

@mmkekic mmkekic force-pushed the fix_pandas_to_pytables branch from 81e02d6 to 2eb3d05 Compare April 10, 2020 16:33
mmkekic added 10 commits April 10, 2020 19:13
The tests check: all elements in function argument are in
tables.attrs.columns_to_index; KeyError with column name is raised if input
list is not subset of dataframe columns; the argument is
not given nothing is flagged.
The writer is now labeling columns_to_be_index. The table is not
indexed since it should be done after the file is fully written.
The test where dataframe is read from
Kr83_full_nexus_v5_03_01_ACTIVE_7bar_1evt.sim.h5 file that contains
strings is added, and the test_store_pandas_as_tables_exact does not
decode explicitly.
Since the writer has different structure than others the auxiliary
_df_writer had to be defined
@bpalmeiro bpalmeiro force-pushed the fix_pandas_to_pytables branch from 2eb3d05 to 794c684 Compare April 10, 2020 17:14
@bpalmeiro bpalmeiro merged commit 15c87f3 into next-exp:master Apr 10, 2020
andLaing added a commit to andLaing/IC that referenced this pull request Apr 10, 2020
Remove _decode_str_columns which is now
executed in load_dst. Change name of function
used in mc_writer to new name approved in
PR next-exp#716
andLaing added a commit to andLaing/IC that referenced this pull request May 4, 2020
Remove _decode_str_columns which is now
executed in load_dst. Change name of function
used in mc_writer to new name approved in
PR next-exp#716
andLaing added a commit to andLaing/IC that referenced this pull request May 4, 2020
Remove _decode_str_columns which is now
executed in load_dst. Change name of function
used in mc_writer to new name approved in
PR next-exp#716
@mmkekic mmkekic deleted the fix_pandas_to_pytables branch February 22, 2021 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants