Print series of prime numbers in python

You need to check all numbers from 2 to n-1 (to sqrt(n) actually, but ok, let it be n). If n is divisible by any of the numbers, it is not prime. If a number is prime, print it. You can write the same much shorter and more pythonic: As I’ve said already, it would … Read more

Convert pandas data frame to series

It’s not smart enough to realize it’s still a “vector” in math terms. Say rather that it’s smart enough to recognize a difference in dimensionality. 🙂 I think the simplest thing you can do is select that row positionally using iloc, which gives you a Series with the columns as the new index and the values … Read more

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