Skip to content
Advertisement

Tag: pandas

Query table with compound primary keys

I’m using pyodbc to connect to a machine database, and query a number of tables in that database using pandas.read_sql(tbl,cnxn), where tbl = “SELECT * FROM TABLE”, cnxn is pyodbc.connect(‘DSN=DATASOURCE;UID=USERID;PWD=PASSWORD’). It works on most tables, but some tables return: DatabaseError: Execution failed on sql ‘SELECT * FROM TABLE’: (’42S02′, ‘[42S02] [Microsoft][ODBC driver for Oracle][Oracle]ORA-00942: table or view does not exist

Many to many join behaviour

Not really sure how to title this question, but here’s the situation. I have one data frame (dfOrders) that has an order_id and basic information like so: |order_id|full_name|order_date|billing|…

Conditional Join Between SQL Table and Pandas Dataframe

I am working on an application and one step of the processing involves joining drug NDC’s from claim data with a table that contains the NDC along with a variety of other information including unit price, multisource code, and more. The table of claims data looks something like this: It was read into a Pandas dataframe as follows: The SQL

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

How to implement SQL Row_number in Python Pandas?

I am trying to number my dataframe records using SQL “Row_number over” function available in SQL but it results in error as shown in the image. Please note that I don’t wish to number records using Pandas function. Here is the code output of df1.head statement Once I execute this statement it throws an error This code is from Python

Advertisement