Doing a t-test on a normally distributed difference of two non normal distributions I have two populations of donations (segment 2 people were subject to a different form):
              seg 1        seg 2
count   1772.000000  1645.000000
mean      93.576185   108.259574
std      301.248967   241.837942
min        3.000000     3.000000
25%       20.000000    20.000000
50%       40.000000    50.000000
75%       72.750000   100.000000
max     9000.000000  6200.000000

They don't look very normal. This is the log distribution:

But their difference does:
means = []
for i in range(0,10000):
  means.append(df_segment_1.sample(1772, replace=True).mean() - df_segment_2.sample(1645, replace=True).mean())

import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline

np.random.seed(42)

plt.hist(means, density=True, bins=30)  # density=False would make counts
plt.ylabel('Probability')
plt.xlabel('Mean difference of donations');


So I wanted to know how can I do a t-test on this population in order to know if segment 2 is significantly higher than segment 1?
 A: The resampling with replacement done is very appropriate and shows  that the distribution of mean differences is close to Gaussian. This suggest that using a $t$-test is not completely misguided. We can use a $t$-test here but it is probably not our best option. On that regard, if want to use a $t$-test it will be  safer to use Welch $t$-test instead of Student's $t$-test to avoid assuming equal variances.
Please note that the fact that your raw data is non-normal does not invalidate the test - as mentioned in Dave's comment we care for the difference between the two means, not the samples themselves. This has been extensively covered a couple times here. e.g. see:

*

*T-test for non normal when N>50?

*Should I use t-test on highly skewed data ? Scientific proof, please?
That said, using Mann-Whitney-Wilcoxon rank-sum test, is a potentially better approach because it as almost as powerful (i.e. it will detect an effect if it is there) as the $t$-test if the normality assumption holds and more powerful if it does not. Somewhat simplistically, we will test of our two samples are sampled from continuous distributions with equal medians.
I would suggest reading Glen_b's exceptional answer in the thread: How to choose between t-test or non-parametric test e.g. Wilcoxon in small samples if you want some quick formal references. For a book: Nonparametric Statistical Methods by Hollander et al. is consider quite standard. If not too averse towards R, Nonparametric Statistical Methods Using R by Kloke & McKean is also very good (the R code is easy to follow, nothing crazy), I found the pace and the exposition was really nice.
