Initial commit
This commit is contained in:
66
_data/candles/!clean_csv.py
Normal file
66
_data/candles/!clean_csv.py
Normal file
@ -0,0 +1,66 @@
|
||||
import pandas as pd
|
||||
import os
|
||||
|
||||
def process_csv_in_directory(directory_path='.'):
|
||||
"""
|
||||
Finds all CSV files in a specified directory, removes duplicate rows,
|
||||
and saves the cleaned data to new files.
|
||||
|
||||
Args:
|
||||
directory_path (str): The path to the directory containing the CSV files.
|
||||
Defaults to the current directory '.'.
|
||||
"""
|
||||
# 1. Get a list of all files in the specified directory
|
||||
try:
|
||||
all_files = os.listdir(directory_path)
|
||||
except FileNotFoundError:
|
||||
print(f"Error: The directory '{directory_path}' was not found.")
|
||||
return
|
||||
|
||||
# 2. Filter the list to include only CSV files
|
||||
csv_files = [f for f in all_files if f.endswith('.csv')]
|
||||
|
||||
if not csv_files:
|
||||
print("No CSV files found in the directory.")
|
||||
return
|
||||
|
||||
print(f"Found {len(csv_files)} CSV files to process...\n")
|
||||
|
||||
# 3. Loop through each CSV file and process it
|
||||
for filename in csv_files:
|
||||
file_path = os.path.join(directory_path, filename)
|
||||
|
||||
try:
|
||||
# --- Step 1: Open the CSV file ---
|
||||
print(f"--- Processing file: {filename} ---")
|
||||
df = pd.read_csv(file_path)
|
||||
initial_rows = len(df)
|
||||
print(f"Initial rows: {initial_rows}")
|
||||
|
||||
# --- Step 2: Remove doubled (duplicate) rows ---
|
||||
df.drop_duplicates(inplace=True)
|
||||
final_rows = len(df)
|
||||
|
||||
# --- Step 3: Print summary ---
|
||||
duplicates_removed = initial_rows - final_rows
|
||||
print(f"Duplicate rows removed: {duplicates_removed}")
|
||||
print(f"Final rows: {final_rows}")
|
||||
|
||||
# --- Step 4: Save the updated CSV file ---
|
||||
# Create a new filename to avoid overwriting the original
|
||||
new_filename = filename.replace('.csv', '_cleaned.csv')
|
||||
new_file_path = os.path.join(directory_path, new_filename)
|
||||
|
||||
# Save the cleaned DataFrame to the new file
|
||||
# index=False prevents pandas from writing the DataFrame index as a column
|
||||
df.to_csv(new_file_path, index=False)
|
||||
print(f"Cleaned data saved to: '{new_filename}'\n")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Could not process {filename}. Error: {e}\n")
|
||||
|
||||
# --- How to use it ---
|
||||
# Run the function on the current directory
|
||||
# To specify a different directory, pass it as an argument,
|
||||
# e.g., process_csv_in_directory('/path/to/your/files')
|
||||
process_csv_in_directory()
|
||||
219
_data/coin_precision.json
Normal file
219
_data/coin_precision.json
Normal file
@ -0,0 +1,219 @@
|
||||
{
|
||||
"0G": 0,
|
||||
"2Z": 0,
|
||||
"AAVE": 2,
|
||||
"ACE": 2,
|
||||
"ADA": 0,
|
||||
"AI": 1,
|
||||
"AI16Z": 1,
|
||||
"AIXBT": 0,
|
||||
"ALGO": 0,
|
||||
"ALT": 0,
|
||||
"ANIME": 0,
|
||||
"APE": 1,
|
||||
"APEX": 0,
|
||||
"APT": 2,
|
||||
"AR": 2,
|
||||
"ARB": 1,
|
||||
"ARK": 0,
|
||||
"ASTER": 0,
|
||||
"ATOM": 2,
|
||||
"AVAX": 2,
|
||||
"AVNT": 0,
|
||||
"BABY": 0,
|
||||
"BADGER": 1,
|
||||
"BANANA": 1,
|
||||
"BCH": 3,
|
||||
"BERA": 1,
|
||||
"BIGTIME": 0,
|
||||
"BIO": 0,
|
||||
"BLAST": 0,
|
||||
"BLUR": 0,
|
||||
"BLZ": 0,
|
||||
"BNB": 3,
|
||||
"BNT": 0,
|
||||
"BOME": 0,
|
||||
"BRETT": 0,
|
||||
"BSV": 2,
|
||||
"BTC": 5,
|
||||
"CAKE": 1,
|
||||
"CANTO": 0,
|
||||
"CATI": 0,
|
||||
"CELO": 0,
|
||||
"CFX": 0,
|
||||
"CHILLGUY": 0,
|
||||
"COMP": 2,
|
||||
"CRV": 1,
|
||||
"CYBER": 1,
|
||||
"DOGE": 0,
|
||||
"DOOD": 0,
|
||||
"DOT": 1,
|
||||
"DYDX": 1,
|
||||
"DYM": 1,
|
||||
"EIGEN": 2,
|
||||
"ENA": 0,
|
||||
"ENS": 2,
|
||||
"ETC": 2,
|
||||
"ETH": 4,
|
||||
"ETHFI": 1,
|
||||
"FARTCOIN": 1,
|
||||
"FET": 0,
|
||||
"FIL": 1,
|
||||
"FRIEND": 1,
|
||||
"FTM": 0,
|
||||
"FTT": 1,
|
||||
"FXS": 1,
|
||||
"GALA": 0,
|
||||
"GAS": 1,
|
||||
"GMT": 0,
|
||||
"GMX": 2,
|
||||
"GOAT": 0,
|
||||
"GRASS": 1,
|
||||
"GRIFFAIN": 0,
|
||||
"HBAR": 0,
|
||||
"HEMI": 0,
|
||||
"HMSTR": 0,
|
||||
"HPOS": 0,
|
||||
"HYPE": 2,
|
||||
"HYPER": 0,
|
||||
"ILV": 2,
|
||||
"IMX": 1,
|
||||
"INIT": 0,
|
||||
"INJ": 1,
|
||||
"IO": 1,
|
||||
"IOTA": 0,
|
||||
"IP": 1,
|
||||
"JELLY": 0,
|
||||
"JTO": 0,
|
||||
"JUP": 0,
|
||||
"KAITO": 0,
|
||||
"KAS": 0,
|
||||
"LAUNCHCOIN": 0,
|
||||
"LAYER": 0,
|
||||
"LDO": 1,
|
||||
"LINEA": 0,
|
||||
"LINK": 1,
|
||||
"LISTA": 0,
|
||||
"LOOM": 0,
|
||||
"LTC": 2,
|
||||
"MANTA": 1,
|
||||
"MATIC": 1,
|
||||
"MAV": 0,
|
||||
"MAVIA": 1,
|
||||
"ME": 1,
|
||||
"MELANIA": 1,
|
||||
"MEME": 0,
|
||||
"MERL": 0,
|
||||
"MET": 0,
|
||||
"MEW": 0,
|
||||
"MINA": 0,
|
||||
"MKR": 4,
|
||||
"MNT": 1,
|
||||
"MON": 0,
|
||||
"MOODENG": 0,
|
||||
"MORPHO": 1,
|
||||
"MOVE": 0,
|
||||
"MYRO": 0,
|
||||
"NEAR": 1,
|
||||
"NEIROETH": 0,
|
||||
"NEO": 2,
|
||||
"NFTI": 1,
|
||||
"NIL": 0,
|
||||
"NOT": 0,
|
||||
"NTRN": 0,
|
||||
"NXPC": 0,
|
||||
"OGN": 0,
|
||||
"OM": 1,
|
||||
"OMNI": 2,
|
||||
"ONDO": 0,
|
||||
"OP": 1,
|
||||
"ORBS": 0,
|
||||
"ORDI": 2,
|
||||
"OX": 0,
|
||||
"PANDORA": 5,
|
||||
"PAXG": 3,
|
||||
"PENDLE": 0,
|
||||
"PENGU": 0,
|
||||
"PEOPLE": 0,
|
||||
"PIXEL": 0,
|
||||
"PNUT": 1,
|
||||
"POL": 0,
|
||||
"POLYX": 0,
|
||||
"POPCAT": 0,
|
||||
"PROMPT": 0,
|
||||
"PROVE": 0,
|
||||
"PUMP": 0,
|
||||
"PURR": 0,
|
||||
"PYTH": 0,
|
||||
"RDNT": 0,
|
||||
"RENDER": 1,
|
||||
"REQ": 0,
|
||||
"RESOLV": 0,
|
||||
"REZ": 0,
|
||||
"RLB": 0,
|
||||
"RNDR": 1,
|
||||
"RSR": 0,
|
||||
"RUNE": 1,
|
||||
"S": 0,
|
||||
"SAGA": 1,
|
||||
"SAND": 0,
|
||||
"SCR": 1,
|
||||
"SEI": 0,
|
||||
"SHIA": 0,
|
||||
"SKY": 0,
|
||||
"SNX": 1,
|
||||
"SOL": 2,
|
||||
"SOPH": 0,
|
||||
"SPX": 1,
|
||||
"STBL": 0,
|
||||
"STG": 0,
|
||||
"STRAX": 0,
|
||||
"STRK": 1,
|
||||
"STX": 1,
|
||||
"SUI": 1,
|
||||
"SUPER": 0,
|
||||
"SUSHI": 1,
|
||||
"SYRUP": 0,
|
||||
"TAO": 3,
|
||||
"TIA": 1,
|
||||
"TNSR": 1,
|
||||
"TON": 1,
|
||||
"TRB": 2,
|
||||
"TRUMP": 1,
|
||||
"TRX": 0,
|
||||
"TST": 0,
|
||||
"TURBO": 0,
|
||||
"UMA": 1,
|
||||
"UNI": 1,
|
||||
"UNIBOT": 3,
|
||||
"USTC": 0,
|
||||
"USUAL": 1,
|
||||
"VINE": 0,
|
||||
"VIRTUAL": 1,
|
||||
"VVV": 2,
|
||||
"W": 1,
|
||||
"WCT": 0,
|
||||
"WIF": 0,
|
||||
"WLD": 1,
|
||||
"WLFI": 0,
|
||||
"XAI": 1,
|
||||
"XLM": 0,
|
||||
"XPL": 0,
|
||||
"XRP": 0,
|
||||
"YGG": 0,
|
||||
"YZY": 0,
|
||||
"ZEC": 2,
|
||||
"ZEN": 2,
|
||||
"ZEREBRO": 0,
|
||||
"ZETA": 1,
|
||||
"ZK": 0,
|
||||
"ZORA": 0,
|
||||
"ZRO": 1,
|
||||
"kBONK": 0,
|
||||
"kDOGS": 0,
|
||||
"kFLOKI": 0,
|
||||
"kLUNC": 0,
|
||||
"kNEIRO": 1,
|
||||
"kPEPE": 0,
|
||||
"kSHIB": 0
|
||||
}
|
||||
Reference in New Issue
Block a user