I’m not sure, why this error occurs, but it seems to be related to handling unicode strings.
I tried the code with Python3.6 and it worked by adding the following bit:
gpu_df = pd.read_csv(StringIO(u"".join(gpu_stats)),
                         names=['memory.used', 'memory.free'],
                         skiprows=1)