Skip to content
Advertisement

Tag: python

Compare two data frames and find number of nulls

I have a problem. I heve data frame 1 named “df”: enter image description here And I have the data frame 2 named “dfP1”: enter image description here I want to compare the unique rows that exist in colum “Campo a Validar” from “dfP1” vs the columns in “df”, if exist a coincidence that count the number of nulls in

Get executed sql statement in pymysql

I am executing a query that is invalid, but I’d like to be able to see exactly what the query is being executed by pymysql to debug it. Is there a way to do something like: Answer As per the documentation, you should be able to do: This read-only property returns the last executed statement as a string. The statement

String formatting — skip one format string

I have the following sql statement: Basically I want to string-format everything except for the second-to-last format string so it looks like: What would be the best way to do this? Answer Double %% the single % to escape it: Where is the StringBorg that we direly need? That would make this safe.

Transform table to smoothen records in one column

the situation (a real life situation) is: I have a table with “log” records, for simplicity let’s assume there are only columns NAME, TIME, STATE (in reality there are few more). There are cca 1 Milion rows in which there are 100 Names (computers) and cca 10 states (productive, idle, automated, maintenance…) This can be interpreted as: *At t0 computer1

Advertisement