Created
May 21, 2022 14:30
-
-
Save ricky9w/6c6f22994a95f6fed40601b959570f60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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