Skip to content

Instantly share code, notes, and snippets.

@ricky9w
Created May 21, 2022 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricky9w/6c6f22994a95f6fed40601b959570f60 to your computer and use it in GitHub Desktop.
Save ricky9w/6c6f22994a95f6fed40601b959570f60 to your computer and use it in GitHub Desktop.
import os
import pandas as pd
lower_bound = int(input("Please enter the lower bound: "))
upper_bound = int(input("Please enter the upper bound: "))
file_list = []
for file_name in os.listdir("."):
if file_name.endswith(".csv"):
file_list.append(file_name)
for file_name in file_list:
df = pd.read_csv(file_name, header=0, skiprows=1)
df = df[(df["X(Thompsons)"] >= lower_bound) & (df["X(Thompsons)"] <= upper_bound)]
df = df.sort_values(by=["Y(Counts)"], ascending=False)
print(df)
df.to_csv("new_" + file_name, index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment