Monday, 30 May 2022

limiting data set to be used xlim

I have lots of files that contain x, y, yerr columns. I read them and save and apply a change on the x values, then I would like to set a limit on the x values I will use afterwards which are the newxval:

for key, value in files_data.items():
    
    file_short_name = key
    main = value[1]
    data = pd.DataFrame(value[0])
    
    has_error = data.shape[1] == 3
    if has_error:
        error = data[2]
    xval= data[0]
    yval= data[1]
    
    P = 11293 
    B = xval*(2/(5+D))
    newxval = a*((B/P)

I have an idea for the limit on data (for min and max only) but I am not sure how to apply this on newxval instead of data[0] and I am not sure how to set, say a value like between 5 to 100

    xlim = [data[0].min(), data[0].max()]
    data = data[(data[0] >= xlim[0]) & (data[0] <= xlim[1])] 


from limiting data set to be used xlim

No comments:

Post a Comment