linux tee is not responding

From man python: -u Force stdin, stdout and stderr to be totally unbuffered. On systems where it matters, also put stdin, stdout and stderr in binary mode. Note that there is internal buffering in xreadlines(), readlines() and file- object iterators (“for line in sys.stdin”) which is not influenced by this option. To work around this, … Read more

How can I iterate over rows in a Pandas DataFrame?

DataFrame.iterrows is a generator which yields both the index and row (as a Series): import pandas as pd df = pd.DataFrame({‘c1’: [10, 11, 12], ‘c2’: [100, 110, 120]}) df = df.reset_index() # make sure indexes pair with number of rows for index, row in df.iterrows(): print(row[‘c1’], row[‘c2’]) 10 100 11 110 12 120 Obligatory disclaimer … Read more

Use of eval in Python

eval and exec are handy quick-and-dirty way to get some source code dynamically, maybe munge it a bit, and then execute it — but they’re hardly ever the best way, especially in production code as opposed to “quick-and-dirty” prototypes &c. For example, if I had to deal with such dynamic Python sources, I’d reach for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)