Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

The or and and python statements require truth-values. For pandas these are considered ambiguous so you should use “bitwise” | (or) or & (and) operations: These are overloaded for these kind of datastructures to yield the element-wise or (or and). Just to add some more explanation to this statement: The exception is thrown when you want to get the bool of a pandas.Series: What you hit was a place where the operator implicitly converted … Read more

Reading an Excel file in python using pandas

Close: first you call ExcelFile, but then you call the .parse method and pass it the sheet name. What you’re doing is calling the method which lives on the class itself, rather than the instance, which is okay (although not very idiomatic), but if you’re doing that you would also need to pass the sheet … Read more

How to deal with SettingWithCopyWarning in Pandas

The SettingWithCopyWarning was created to flag potentially confusing “chained” assignments, such as the following, which does not always work as expected, particularly when the first selection returns a copy. [see GH5390 and GH5597 for background discussion.] The warning offers a suggestion to rewrite as follows: However, this doesn’t fit your usage, which is equivalent to: While it’s clear that you don’t care … Read more

How to deal with SettingWithCopyWarning in Pandas

The SettingWithCopyWarning was created to flag potentially confusing “chained” assignments, such as the following, which does not always work as expected, particularly when the first selection returns a copy. [see GH5390 and GH5597 for background discussion.] The warning offers a suggestion to rewrite as follows: However, this doesn’t fit your usage, which is equivalent to: While it’s clear that you don’t care … Read more

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