Download inspect_data.py from recommender-system/llmproccrs: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/recommender-system/llmproccrs/resolve/main/inspect_data.py
- Command line
-
hf download hf://recommender-system/llmproccrs/inspect_data.py
-
curl -L -o inspect_data.py https://huggingface.co/recommender-system/llmproccrs/resolve/main/inspect_data.py
1.01 kB
| import pandas as pd | |
| import os | |
| # Konfigurasi agar Pandas menampilkan semua kolom dan teks yang panjang | |
| pd.set_option('display.max_columns', None) # Tampilkan semua kolom | |
| pd.set_option('display.expand_frame_repr', False) # Jangan potong tabel ke baris baru | |
| pd.set_option('display.max_colwidth', None) # Tampilkan seluruh isi teks di dalam sel | |
| files = ['categories.csv', 'filtered_products.csv', 'kbli.csv', 'suppliers.csv'] | |
| directory = 'datasets' | |
| for file_name in files: | |
| file_path = os.path.join(directory, file_name) | |
| print(f"--- DETAIL DATA: {file_name} ---") | |
| if os.path.exists(file_path): | |
| try: | |
| df = pd.read_csv(file_path) | |
| # Menggunakan head(5) dengan opsi tampilan yang sudah diatur di atas | |
| print(df.head(5).to_string(index=False)) # to_string memastikan semua kolom muncul | |
| except Exception as e: | |
| print(f"Error: {e}") | |
| else: | |
| print(f"File {file_name} tidak ditemukan.") | |
| print("\n" + "="*80 + "\n") |