Is the following formula right if I want to measure the standard error of the median in case of a small sample with non normal distribution (I'm using python)?
sigma=np.std(data)
n=len(data)
sigma_median=1.253*sigma/np.sqrt(n)
Is the following formula right if I want to measure the standard error of the median in case of a small sample with non normal distribution (I'm using python)?
sigma=np.std(data)
n=len(data)
sigma_median=1.253*sigma/np.sqrt(n)
Sokal and Rohlf give this formula in their book Biometry (page 139). Under "Comments on applicability" they write: Large samples from normal populations. Thus, I am afraid that the answer to your question is no. See also here.
One way to obtain the standard error and confidence intervals for the median in small samples with non-normal distributions would be bootstrapping. This post provides links to Python packages for bootstrapping.
Warning
@whuber pointed out that bootstrapping the median in small samples isn't very informative as the justifications of the bootstrap are asymptotic (see comments below).
The magic number 1.253 comes from the asymptotic variance formula: $$ {\rm As. Var.}[\hat m] = \frac1{4f(m)^2 n} $$ where $m$ is the true median, and $f(m)$ is the true density at that point.
For any distribution other than the normal (and mary admits that this is doubtful in her data), you would have a different factor. Getting the median estimate $\hat m$ is not such a big deal, although you can start agonizing about the middle values for the even number of observations vs. inverting the cdf or something like that. The relevant density value can be estimated by kernel density estimators, if needed. Overall, this of course is relatively dubious as three approximations are being taken:
The lower the sample size, the more dubious it gets.
Based on some of @mary's comments I think the following is appropriate. She seems to be selecting the median because the sample is small.
If you were selecting median because it's a small sample that's not a good justification. You select median because the median is an important value. It says something different from the mean. You might also select it for some statistical calculations because it's robust against certain problems like outliers or skew. However, small sample size isn't one of those problems it's robust against. For example, when sample size gets smaller it's actually much more sensitive to skew than the mean.
Not a solution here, but perhaps helpful:
Suppose your data distribution is $p(x)$, and let $P(x) = \int_{-\infty}^x p$ be the cumulative density function. So the median of the distribution is the number m such that P(m) = 1/2.
Following this helpful page we can compute the distribution of a number $x$ being the median of $n$ samples of this distribution. I think it is $q(x) = c_n p(x) (P(x)(1-P(x)))^{(n-1)/2}$. Here $c_n$ is the appropriate constant to make this a probability distribution, and I think it is n-1 choose (n-1)/2 if n is odd (unsure on that).
Finally, you would like to know the variance of q(x), which you may be able to reason about with this formula.