コード例 #1
0
              table=0,
              status="active",
              drop=False,
              keys=[-1]))

# Translate value up
w.add(dw.Translate(column=["value"],
                   table=0,
                   status="active",
                   drop=False,
                   direction="up",
                   values=1))

# Drop value
w.add(dw.Drop(column=["value"],
              table=0,
              status="active",
              drop=True))

# Extract from fold between positions 4, 5
w.add(dw.Extract(column=["fold"],
                 table=0,
                 status="active",
                 drop=False,
                 result="column",
                 update=False,
                 insert_position="right",
                 row=None,
                 on=None,
                 before=None,
                 after=None,
                 ignore_between=None,
コード例 #2
0
def get_transform():
    w = dw.DataWrangler()

    # Split data repeatedly on newline  into  rows
    w.add(
        dw.Split(column=["data"],
                 table=0,
                 status="active",
                 drop=True,
                 result="row",
                 update=False,
                 insert_position="right",
                 row=None,
                 on="\n",
                 before=None,
                 after=None,
                 ignore_between=None,
                 which=1,
                 max=0,
                 positions=None,
                 quote_character=None))

    # Delete empty rows
    w.add(
        dw.Filter(column=[],
                  table=0,
                  status="active",
                  drop=False,
                  row=dw.Row(column=[],
                             table=0,
                             status="active",
                             drop=False,
                             conditions=[
                                 dw.Empty(column=[],
                                          table=0,
                                          status="active",
                                          drop=False,
                                          percent_valid=0,
                                          num_valid=0)
                             ])))

    # Delete  rows where data starts with '==='
    w.add(
        dw.Filter(column=[],
                  table=0,
                  status="active",
                  drop=False,
                  row=dw.Row(column=[],
                             table=0,
                             status="active",
                             drop=False,
                             conditions=[
                                 dw.StartsWith(column=[],
                                               table=0,
                                               status="active",
                                               drop=False,
                                               lcol="data",
                                               value="===",
                                               op_str="starts with")
                             ])))

    # Delete  rows where data = '<!-- KBDX was Broadus Airport ...
    w.add(
        dw.Filter(
            column=[],
            table=0,
            status="active",
            drop=False,
            row=dw.Row(
                column=[],
                table=0,
                status="active",
                drop=False,
                conditions=[
                    dw.
                    Eq(column=[],
                       table=0,
                       status="active",
                       drop=False,
                       lcol="data",
                       value=
                       "<!-- KBDX was Broadus Airport in Broadus, Montana. Replaced by new airport with FAA ID: 00F -->",
                       op_str="=")
                ])))

    # Delete  rows where data contains '<s>''''
    w.add(
        dw.Filter(column=[],
                  table=0,
                  status="active",
                  drop=False,
                  row=dw.Row(column=[],
                             table=0,
                             status="active",
                             drop=False,
                             conditions=[
                                 dw.Contains(column=[],
                                             table=0,
                                             status="active",
                                             drop=False,
                                             lcol="data",
                                             value="<s>'''",
                                             op_str="contains")
                             ])))

    # Extract from data between positions 5, 9
    w.add(
        dw.Extract(column=["data"],
                   table=0,
                   status="active",
                   drop=False,
                   result="column",
                   update=False,
                   insert_position="right",
                   row=None,
                   on=None,
                   before=None,
                   after=None,
                   ignore_between=None,
                   which=1,
                   max=1,
                   positions=[5, 9]))

    # Drop data
    w.add(dw.Drop(column=["data"], table=0, status="active", drop=True))

    return w
コード例 #3
0
               result="row",
               update=False,
               insert_position="right",
               row=None,
               on=" ",
               before=None,
               after=None,
               ignore_between=None,
               which=1,
               max="0",
               positions=None,
               quote_character=None))

# Drop split
w.add(dw.Drop(column=["split"],
              table=0,
              status="active",
              drop=True))

# Split split2 repeatedly on ';'  into  rows
w.add(dw.Split(column=["split2"],
               table=0,
               status="active",
               drop=True,
               result="row",
               update=False,
               insert_position="right",
               row=None,
               on=";",
               before=None,
               after=None,
               ignore_between=None,
コード例 #4
0
               status="active",
               drop=False,
               result="column",
               update=False,
               insert_position="right",
               row=None,
               on="Fourth place",
               before=None,
               after=None,
               ignore_between=None,
               which=1,
               max=1,
               positions=None))

# Drop fold
w.add(dw.Drop(column=["fold"], table=0, status="active", drop=True))

# Copy extract1
w.add(
    dw.Copy(column=["extract1"],
            table=0,
            status="active",
            drop=False,
            result="column",
            update=False,
            insert_position="right",
            row=dw.Row(column=[],
                       table=0,
                       status="active",
                       drop=False,
                       conditions=[