Index of frequency larger than power spectrum length

I am new in this community. So excuse me if it seems easy.

I want to calculate the amplitude of a specific frequency in a signal. The frequency precision is (relevant question) $$df = \frac{fs}{NP}$$ $$fs=1/dt$$ NP is the number of points in the signal time seri. The index of the frequency in the signal is $$ind = \frac{f}{df}$$ the length of power spectrum array of signal is length(pxx) = NP/2-1

Example 1: for small frequencies

frequency = 1.0/128.0
dt=0.4
df = 0.001
NP = fs/df=2500
index of the signal = 8

lenght of pxx is 1249 so no problem.

Example 2: for large frequencies

freq = 2.0
dt=0.4
NP = fs/df=2500
index of the signal = 2000

The index of the frequency is larger than the number of points in pxx. If I double the number of points in the signal, the frequency precision halves and the index of frequency also doubles. Is there a frequency limit or I am doing something wrong?

Thanks for any guide.

$$f = \frac{f_s}{2} = f_N$$
$f_N$ is called the Nyquist frequency. Frequencies in the signal higher than $f_N$ are subject to aliasing (related to the Nyquist-Shannon sampling theorem).
So if you want to find information about a certain frequency $f_x$, you will need at least a sampling frequency of $f_s > 2\cdot f_x$ and extra to accommodate for an anti-alias filter.