Example #1
0
# Delete  rows where Nation is null
w.add(
    dw.Filter(column=[],
              table=0,
              status="active",
              drop=False,
              row=dw.Row(column=[],
                         table=0,
                         status="active",
                         drop=False,
                         conditions=[
                             dw.IsNull(column=[],
                                       table=0,
                                       status="active",
                                       drop=False,
                                       lcol="Nation",
                                       value=None,
                                       op_str="is null")
                         ])))

# Fold split, split2, split3, split4...  using  header as a key
w.add(
    dw.Fold(column=["split", "split2", "split3", "split4", "split5"],
            table=0,
            status="active",
            drop=False,
            keys=[-1]))

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

# Delete  rows where extract is null
w.add(dw.Filter(column=[],
                table=0,
                status="active",
                drop=False,
                row=dw.Row(column=[],
             table=0,
             status="active",
             drop=False,
             conditions=[dw.IsNull(column=[],
                table=0,
                status="active",
                drop=False,
                lcol="extract",
                value=None,
                op_str="is null")])))

# Delete  rows where extract = '5'
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,
# Delete  rows where song is null
w.add(
    dw.Filter(column=[],
              table=0,
              status="active",
              drop=False,
              row=dw.Row(column=[],
                         table=0,
                         status="active",
                         drop=False,
                         conditions=[
                             dw.IsNull(column=[],
                                       table=0,
                                       status="active",
                                       drop=False,
                                       lcol="song",
                                       value=None,
                                       op_str="is null")
                         ])))

# Set  extract  name to  year
w.add(
    dw.SetName(column=["extract"],
               table=0,
               status="active",
               drop=True,
               names=["year"],
               header_row=None))

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