Skip to content
Snippets Groups Projects
Commit fb315fc8 authored by Dhruvang Patel's avatar Dhruvang Patel
Browse files

Update Add_Fake_data.py

parent a40b0a9e
No related branches found
No related tags found
No related merge requests found
...@@ -41,7 +41,7 @@ def add_fake_data_to_csv(file_path, output_path): ...@@ -41,7 +41,7 @@ def add_fake_data_to_csv(file_path, output_path):
# Read the original CSV file # Read the original CSV file
df = pd.read_csv(file_path) df = pd.read_csv(file_path)
# Determine the number of fake rows (25% of the original data) # Added 25% realistic fake data
num_rows_to_add = int(0.25 * len(df)) num_rows_to_add = int(0.25 * len(df))
# Create a dictionary to store fake data # Create a dictionary to store fake data
...@@ -52,14 +52,14 @@ def add_fake_data_to_csv(file_path, output_path): ...@@ -52,14 +52,14 @@ def add_fake_data_to_csv(file_path, output_path):
# Create a DataFrame for the fake data # Create a DataFrame for the fake data
fake_df = pd.DataFrame(fake_data) fake_df = pd.DataFrame(fake_data)
# Append the fake data to the original DataFrame
combined_df = pd.concat([df, fake_df], ignore_index=True) combined_df = pd.concat([df, fake_df], ignore_index=True)
# Save the updated DataFrame to a new CSV file # Save the updated DataFrame to a new CSV file
combined_df.to_csv(output_path, index=False) combined_df.to_csv(output_path, index=False)
except Exception as e: except Exception as e:
# Example usage
# Specify the input and output file paths # Specify the input and output file paths
input_csv = "Airline_Dataset.csv" # Replace with the path to your input CSV file input_csv = "Airline_Dataset.csv" # Replace with the path to your input CSV file
output_csv = "FakeDataset.csv" # Replace with the desired output file path output_csv = "FakeDataset.csv" # Replace with the desired output file path
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment