Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip empty param for suffix and prefix #514

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

v2ngu
Copy link

@v2ngu v2ngu commented Jun 12, 2024

Added a new option for suffix and prefix wrangles to skip empty cells

      skip_empty:
        type: boolean
        desription: Whether to skip empty values
        default: (Optional) false

@v2ngu v2ngu closed this Jun 12, 2024
@v2ngu v2ngu reopened this Jun 12, 2024
Copy link
Contributor

@cerdamario13 cerdamario13 left a comment

Choose a reason for hiding this comment

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

Fix failing tests:

  • test_suffix_skip_mult_empty_false()
  • est_suffix_skip_mult_empty_true():

looks like its just a missed 'ly' on some of the strings.

Also if you want to assert multiple items in a df, you can convert df column to a list to make the code more concise

def test_prefix_skip_mult_empty_false():
    """
    Testing format.prefix with skip_empty false
    """
    data = pd.DataFrame({
        'col1': ['terrestrial','','ordinary'],
        'col2': ['soft','','cripsy'],
    })
    recipe = """
    wrangles:
        - format.prefix:
            input:
                - col1
                - col2
            output: 
                - out1
                - out2
            value: extra-
    """   
    df = wrangles.recipe.run(recipe, dataframe=data)
     assert df['out1'].tolist() == ['extra-terrestrial', 'extra-', 'extra-ordinary']
     # ... rest of assertions

Other than that, looks great!

@v2ngu v2ngu self-assigned this Jun 14, 2024
@v2ngu v2ngu linked an issue Jun 14, 2024 that may be closed by this pull request
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.

Skip_empty For More Wrangles
2 participants