I have a DataFrame made with pandas, formed by the columns ['x','y','z0','z','arbol']
, attached screen of its structure:
From the data of that general DataFrame I have extracted all those whose tree value is equal to 1 creating another DataFrame called arbol1
. Inside the column z0
of the latter, I want to select the values that are between 0.511 and 0.530 to extract them to a .csv file.
I have managed to select the data smaller than 0.530, but I am not able to establish an interval, I only know how to sort my data, select a specific value (for example z0 = 0597) or the values that are below or above a value.
import pandas as pd
df = pd.read_table("0Arbolesavila4.txt",header=0,names=['x','y','z0','z','arbol'])
arbol1 = df[df.arbol == 1]
print(arbol1)
print(arbol1['z0'])
print(arbol1.sort_values(by='z0'))
print(arbol1.loc[arbol1['z0'] == 0.597])
print(arbol1[arbol1.ix[:,2] > 0.511])