I am trying to import a pandas dataframe to Microsoft SQL Server. Even though, the command is correct and executed successfully, when I select the first 1000 rows of the table in SQL server only the …
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
Filtering of records between sysdate and sysdate+7 from Oracle Sql is not working correctly
I am firing an SQL query to filter records between sysdate and sysdate+7 but I am getting records outside the range as well. What is wrong my SQL cursor.execute(“”” select ‘Shipment’ as …
How to fix pandas to_sql append not appending one item out of 2000?
I have a CSV file with 2000 rows and 3 columns of type Int, String, and String respectively. I’m trying to write a program that creates a table and appends my CSV file rowsxcolumns into the table. It …
Find Duplicates on Multiple Criteria
I have a set of financial transactions with a Date, Amount, Description and Source and I want to find transactions where the amount is the same, the date is within one day, but the sources are …
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
Fast SQL record look-up by using hash in Python/pandas
I’m looking to maintain a (Postgres) SQL database collecting data from third parties. As most data is static, while I get a full dump every day, I want to store only the data that is new. I.e., every …