| import os | |
| # Check if a file exists | |
| def file_exists(file_path: str) -> bool: | |
| """ | |
| Checks if a file exists at the given path. | |
| Args: | |
| - file_path (str): Path to the file. | |
| Returns: | |
| - bool: True if file exists, False otherwise. | |
| """ | |
| return os.path.isfile(file_path) | |
| # Save DataFrame to CSV | |
| def save_to_csv(df: pd.DataFrame, file_path: str) -> None: | |
| """ | |
| Saves a DataFrame to a CSV file. | |
| Args: | |
| - df (pd.DataFrame): The DataFrame to save. | |
| - file_path (str): The path to save the file. | |
| """ | |
| df.to_csv(file_path, index=False) | |
| # Display basic info about the dataset (e.g., shape, column names) | |
| def dataset_info(df: pd.DataFrame) -> None: | |
| """ | |
| Displays basic information about the dataset. | |
| Args: | |
| - df (pd.DataFrame): The dataset. | |
| """ | |
| print(f"Shape of dataset: {df.shape}") | |
| print(f"Columns: {df.columns}") | |
| print(f"First few rows:\n{df.head()}") |
Xet Storage Details
- Size:
- 925 Bytes
- Xet hash:
- 10cbe38bc6c4b6dd2a066dbff7033d274a01acaddc52f74c20f604f20db862e9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.