Combine Multiple CSV files into one with Pandas and Glob

Suppose you have multiple *.csv files derived from your machine everyday and you need to combine it into one big .csv for further actions, everybody knows Ctrl-C/Ctrl-V would do the trick but what if we are talking about hundreds  of ’em?

Pandas and glob may be one sound solution to accomplish this task with ease.

In my example I have 4 .csv files in the same folder, each of them has the same header structure:

The first two rows of the .csv file are the headers of the file, when I combine them, I don’t want to include these headers, just the clean data started from row 3 should be read and write into output file.

Here is a small piece of code which could combine all .csv files in the current working folder into one .xlsx (Excel 2013+) file.

the “skiprows = 1” will skip to first 2 rows (The red rectangle part) in each file,  and there is a for loop to read each file into the list_ list, and then each list will be append to the DataFrame.

Trip to Canakkale a.k.a Dardanelles Strait

Dardanelles Strait is not only famous in the ancient Greek myth, but also played, and still playing a very important part in Ottoman Turkey ages, and in modern Geopolitics. as the only exit of the Black sea, Dardanelles strait is one of the most important and busiest sea route for the rim Black Sea countries for Merchants trading and military influences.

Every Empire held the throne of Turkey sees the Dardanelles strait as a key point to power, to triumph, and to wealth. So it is understandable that, the legendary Kalesi (Stronghold) is set here, overlooking the traders, and sometimes troops approaching and leaving, for more than a millennia.














Connect to remote host with netmiko and run some commands from a pre-defined list

Recently I was running into a case that I need to ssh to a remote server and run some commands and repeat it over and over again, this of course is a very boring and tiresome task, and also a perfect scenario where the netmiko lib is been employed.

so I developed this small script, it basically does the follow things:

  1. Connect to a remote host.
  2. Create a log file with the current time and date as part of file name.
  3. Run the commands (which are stored in the “commands.txt” file) line by line on remote server.
  4. Write the output of the remote machine to the log file.

I’m not a programmer and this scripts is a very rough one, for example, it doesn’t have any exception handling mechanism (for now),  but it could get the job done.

and here is the commands.txt, you can modify to anything you want, “show ip route” on a Cisco 1841 router, for example, one command a line.


VBS script to combine multiple excel files into one

This script will combine all excel files in the folder you specified into one master excel file.


Fix the “ImportError: DLL load failed: The specified module could not be found.” Issue for Netmiko

For whatever reason when you encountered the “ImportError: DLL load failed: The specified module could not be found.” Issue for Netmiko, upgrade Python from a previous version to the latest one, most likely, here is my way to fix it.

I upgraded python from 3.6.3 to 3.7 this morning , and after upgrade, the netmiko lib doesn’t work anymore:

some posts on stackoverflow or github sugguest that this issue was due to lack of Visuall C++ redistributable 2015 and you have to install it. and I actually already installed this component before, so this is probably not the solution.


after some research, here is the way to fix it:
pip install –upgrade –force-reinstall netmiko

This command speaks for itself, so no explanation needed.


and after reinstall  the netmiko lib forcibly, you’ll be able to load it error-free: