Skip to content
Permalink
5ab4ed8e4a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
18 lines (13 sloc) 574 Bytes
import pandas as pd
def remove_missing_values(input_csv, output_csv, column_name):
# Read the CSV file into a DataFrame
df = pd.read_csv(input_csv)
# Remove rows with missing values in the specified column
df_cleaned = df.dropna(subset=[column_name])
# Save the cleaned DataFrame back to a CSV file
df_cleaned.to_csv(output_csv, index=False)
# Example usage
input_csv = './CSP_Rank_Scores/CSP_7jq8_CSpred.csv'
output_csv = input_csv[:-4] + "_clean.csv"
column_name = 'consensus'
remove_missing_values(input_csv, output_csv, column_name)