question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use convert with custom function and reference row

See original GitHub issue

Would it be possible to get an example placed in the documentation of using convert with a custom function that has reference to the row? I assume something like this should work?

table = [[a,b,c], [1,2,3]]

def my_func(row):
    return row['b'] + row['c']
    
etl.convert(table, 'a', my_func)

# [[a,b,c], [5,2,3]]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
javidycommented, Mar 22, 2021

hey @carlcorder ,

you’re right about that. It works when I change the signature of the function.

Screenshot 2021-03-22 at 19 59 56

thanks for help 😃

1reaction
carlcordercommented, Mar 20, 2021

Hey Javidy, my hunch is that my_func is not getting called. I think the issue here is that the signature of the function needs to be def my_func(val, row): ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using custom functions in Power Query - Microsoft Learn
Create a custom function from a table reference · Applying transformations to a sample query · Invoke a custom function as a new...
Read more >
Easily Create Your Own Custom Functions in 3 Easy Steps
A Power Query Custom Function is simply a query that is run by other queries. We're going to create a custom function using...
Read more >
Writing a custom function to convert class of variables in a ...
Here's an approach leveraging across and cur_column : library(dplyr) #version >= 1.0.0 df_1 %>% mutate(across(any_of(df_2$var_name), ...
Read more >
Custom Functions in Google Sheets | Apps Script
Using a custom function · Click the cell where you want to use the function. · Type an equals sign ( = )...
Read more >
How to use and store custom functions in Excel - Ablebits
Add the workbook name to the function · Store all the UDFs in one common file · Create an Excel add-in file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found