Aug-24-2022, 05:35 PM
DeaD_EyE Wrote:Pandas feels for me like numpy + black magic.
Pandas is powerful, but what I see is, that people without knowledge about the Core Language Python itself trying to work with this framework.
FYI: I use pandas because I can often save writing a huge amount of code
Here's a snippet which loads an entire directory of .csv files into a database:
def load_all(self): datafiles = self.fpath.ourairport_datafiles filelist = [fn for fn in datafiles.iterdir() if fn.is_file() and fn.suffix == '.csv'] for fn in filelist: tablename = fn.stem.replace('-', '_') df = pd.read_csv(fn) print(f"engine: {self.Model.engine}") df.to_sql(tablename, con=self.Model.engine, if_exists='replace')