How to normalize data between 0 and 1? I have seen the min-max normalization formula in several answers (e.g. [1], [2], [3]), where data is normalized into the interval $\left[0,1 \right]$.
However, is there a method to normalize data into the interval $\left(0,1 \right)$, i.e. excluding 0 and 1?
EDIT:
My data is a sample from a uniform distribution within the range $\left[a,b \right]$. I would like to normalize it into the interval $\left(0,1 \right)$ while remaining uniformly distributed.
 A: Using the property that the CDF is uniformly distributed on $[0,1]$, you can compute the empirical CDF for $x$. This is essentially the same as ranking the data and then rescaling by the number of elements $n$. To enforce the requirement that the scaled data exclude 0 and 1, you can deviate from the standard ECDF procedure and construct the scale so that the outputs are $\frac{1}{n+1}, \frac{2}{n+1},\cdots, \frac{n}{n+1}$, which is likewise uniform.
A: A uniform distribution on $(a, b)$ is the same as a uniform distribution on $[a, b]$, since for any $X$ distributed uniformly on $[a, b]$, $P(X = a) = P(X = b) = 0$. So, just use the formulae for translating to $[0, 1]$. On the other hand, if your sample has a value equal to $a$ or $b$, then you can safely conclude that you don't actually have a continuous uniform distribution.
A: The formula $x' = \frac{x - \min{x}}{\max{x} - \min{x}}$ will normalize the values in $[0,1]$. 
I am not sure of why you want to exclude $0$ and $1$, anyway one way would be to choose a new minimum and maximum values for the transformed variable, e.g. $[0+\epsilon,1-\epsilon]$. You can then transform the variable using 
$$x' = \epsilon + (1-2\epsilon) \cdot \left(\frac{x - \min{x}}{\max{x} - \min{x}} \right)$$
Another way could be, as suggested by Sycorax in his comment, to use a logistic transform
$$ x' = \frac{1}{1 + \exp(-x)} $$
This ensures that $\forall x \in \mathbb{R} \implies x' \in (0,1)$.
However, depending on the original distribution of $x$, $x'$ might span only a limited range of the interval $(0,1)$, so you might want to try e.g. to standardize $x$ before applying the logistic transform.
