I would like to create data with python faker with columns that are dependant on each other

92 Views Asked by At

I have to create a synthetic dataset using faker, in which we have columns that have values that are dependant on each other.

I tried to use standard faker providers, but it seems there is no way to use this to generate dependant data.

For example, I have a column A and a column B. Whenever the column A contains a value X the column B can only contain certain strings [ABC, DCB, VBA]. But if column A would contain a value Y, then column B can only contain values from the list [QWE, ERY, DSA].

Above is an example, but I basically need sort of custom logic and I would like to integrate this using the faker providers. I tried to extend the base provider, but I couldn't find a smart way to do it. Is there an easier, built-in way to do this using faker or some other library?

0

There are 0 best solutions below