host

import pandas as pd
from datetime import datetime
import os

# Example DataFrame
df_final = pd.DataFrame({
    'Name': ['Alice', 'Bob', 'Charlie'],
    'Age': [25, 30, 35],
    'City': ['New York', 'Los Angeles', 'Chicago']
})

# Generate today's date in 'YYYY-MM-DD' format
today = datetime.now().strftime("%Y-%m-%d")

# Create a dynamic filename
filename = f"{today}_data.csv"

# Network drive path (Windows)
network_folder = r"\\network_drive\shared_folder"

# Full path to save the file
full_path = os.path.join(network_folder, filename)

# Save DataFrame to CSV
try:
    df_final.to_csv(full_path, index=False)
    print(f"File saved successfully to {full_path}")
except Exception as e:
    print(f"Error saving file: {e}")

Comments

Popular posts from this blog

Steps to create SSH key from git bash

test