'Is there a way to take a dataset that contains floats between 1-7 and set a range to it so that I only use numbers between 2.6 and 5?

import numpy as np
import matplotlib.pyplot as plt
data = np.loadtxt('Area_-116_32.txt', usecols = 2)
plt.hist(data, bins=40, range=[2.6,5], log=10)
e= np.array(data) 
condition = np.mod(e)>2.6 and np.mod(e)<5

this gives an error of

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [34], in <cell line: 1>()
----> 1 condition = np.mod(e)>2.6 and np.mod(e)<5

TypeError: remainder() takes from 2 to 3 positional arguments but 1 were given

example of some of the data



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source