Skip to content

Main Difference 0.5

deng113jie edited this page Apr 23, 2021 · 3 revisions

ExeTera 0.5 is fully backward compatible, so you do not have to change your scripts. However, here are some new ways of doing things in 0.5 so that you can entirely focus on the analysis.

1, Creating fields using dataframe:

before:

with Session() as s:
    dst = s.open_dataset('/path/to/file','dst','r+')
    field = s.create_numeric('dst','a_numeric_field', 'int32')

Current version 0.5:

with Session() as s:
    dst = s.open_dataset('/path/to/file','dst','r+')
    df = dst.create_dataframe('df')
    field = df.create_numeric('a_numeric_field', 'int32')

2, Move / copy fields without careing about underlying data

before:

field_1 = ...
field_2 = session.create(dst,'foo','int32')
field_2.data.write(field_1.data[:])

Current version 0.5:

df2['foo'] = df['foo']

3, Grouped operations

before:

fielda = session.create_numeric('field_a', 'int32')
fieldb = session.create_numeric('field_b', 'int32')
fieldc = session.create_numeric('field_c', 'int32')
fielda_filtered = session.apply_filter(filter, fielda)
fieldb_filtered = session.apply_filter(filter, fieldb)
fieldc_filtered = session.apply_filter(filter, fieldc)

Current version 0.5:

df.create_numeric('field_a', 'int32')
df.create_numeric('field_b', 'int32')
df.create_numeric('field_c', 'int32')
df.apply_filter(filter)

4, Operations on field directly

before:

result = df['a'].data[:] + df['b'].data[:]
field_c = session.create_numeric(dst,'c', 'int32')
field_c.data.write(result)

Current version 0.5:

df['c'] = df['a'] + df['b']