示例#1
0
# Extract from split after 'in '
w.add(
    dw.Extract(column=["split"],
               table=0,
               status="active",
               drop=False,
               result="column",
               update=False,
               insert_position="right",
               row=None,
               on=".*",
               before=None,
               after="in ",
               ignore_between=None,
               which=1,
               max=1,
               positions=None))

# Fill extract  with values from below
# (here is where this test differs from crime_5.py)
w.add(
    dw.Fill(column=["extract"],
            table=0,
            status="active",
            drop=False,
            direction="up",
            method="copy",
            row=None))

w.apply_to_file('crime.csv').print_csv('out.csv')
示例#2
0
                                         status="active",
                                         drop=False,
                                         indices=[0, 1])
                         ])))

# Fill  rows 1,2,3 with values from the left
w.add(
    dw.Fill(column=[],
            table=0,
            status="active",
            drop=False,
            direction="right",
            method="copy",
            row=dw.Row(column=[],
                       table=0,
                       status="active",
                       drop=False,
                       conditions=[
                           dw.RowIndex(column=[],
                                       table=0,
                                       status="active",
                                       drop=False,
                                       indices=[0, 1, 2])
                       ])))

# Fold split1, split2, split3, split4...  using  1, 2, 3  as keys
w.add(
    dw.Fold(column=[
        "split1", "split2", "split3", "split4", "split5", "split6", "split7",
        "split8", "split9", "split10", "split11", "split12", "split13",
        "split14", "split15", "split16"
示例#3
0
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)
                         ])))

# Transpose table
w.add(dw.Transpose(column=[], table=0, status="active", drop=False))

# Fill transpose  with values from above
w.add(
    dw.Fill(column=["transpose"],
            table=0,
            status="active",
            drop=False,
            direction="down",
            method="copy",
            row=None))

w.apply_to_file('migration.csv').print_csv('out.csv')
示例#4
0
             table=0,
             status="active",
             drop=False,
             conditions=[dw.IsNull(column=[],
                table=0,
                status="active",
                drop=False,
                lcol="pos",
                value=None,
                op_str="is null")])))

# Fill categoria  with values from above
w.add(dw.Fill(column=["categoria"],
              table=0,
              status="active",
              drop=False,
              direction="down",
              method="copy",
              row=None))

# Fill n_categoria  with values from above
w.add(dw.Fill(column=["n_categoria"],
              table=0,
              status="active",
              drop=False,
              direction="down",
              method="copy",
              row=None))

w.apply_to_file(sys.argv[1]).print_csv(sys.argv[2])