How to draw a sample from data set with respect to a given categorical or numerical variable based on given freely chosen distribution? (Python)
Let's assume you want a sample of size $N$ where variable $V$ follows its distribution in the new dataset:


Draw $N$ instances from the new dataset. Let $A= [v_1,..,v_N ]$ the list of $N$  values of $V$ corresponding to these instances.
For every distinct value $v \in A$:


Select the subset $S$ of instances in the old dataset which have $v$ as a value for $V$,
let $\#v$ be the frequency of $v$ in $A$: draw $\#v$ instances from the subset $S$



At the end of this process you have obtained $N$ instance from the old dataset which follow the distribution of $V$ in the new dataset.