Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
34 views

How to create a wrapper class around a python class which enables chaining?

I tried to create a wrapper class around an object which implements chaining (pypika queries) and realised it's really really awkward to do. Tried to add a simple .to_df() method to pypika queries, ...
George Pearse's user avatar
2 votes
1 answer
38 views

NVL join using pandas

I want to perform a NVL join with pandas, e.g. in SQL: select * from TA join TB on TA.column = NVL(TB.column, TA.column) Here is a complete example in SQL, showing what would be expected: /* first ...
Carmellose's user avatar
  • 5,011
-2 votes
1 answer
95 views

How to pass date variable in sql query

I'm currently working on a project where I need to retrieve data from an Oracle database into a Pandas DataFrame. I am trying to use the 'BETWEEN' function to filter records by date, but I'm ...
muhammad fahimaamir's user avatar
0 votes
1 answer
32 views

Dropping Index in Pandas SQLite Query

I'm using pd.read_sql() to write my queries as I work with an SQLite database with several tables. I'm trying to create a dictionary that includes the table name as the key and the number of rows of ...
Chris Kucewicz's user avatar
0 votes
0 answers
80 views

Optimal way to create a dataframe from an SQL query

I'm looking to find a more efficient way to execute SQL queries within Python. My current process seems optimal when running the query, however the conversion process to a data frame appears to be ...
mf17's user avatar
  • 111
0 votes
0 answers
39 views

Convert Pandas Df.info() Into a SQL DDL

I am trying to take a pandas df and move it to a new Vertica table. Is there a way to convert the df.info() so that i coincides as an automated process for building the SQL insert? import io buffer = ...
Tinkinc's user avatar
  • 446
0 votes
0 answers
29 views

Pandas dataframe to sql issues with Boolean values storing as 0 and 1

I am trying to store a dataframe in high has many Boolean columns with True and False values to sql table but when it’s stored to sql using pd.to_sql my Boolean values of Columns gets stored as 0 and ...
G Naik's user avatar
  • 9
0 votes
2 answers
39 views

cx_oracle MERGE USING when matched, when not matched and a Pandas dataframe

I have searched stackoverflow, 'ASK TOM', and oracle forums, but can't find a solution to my problem. I am trying to either update or insert into a table based on whether or not the keys exist in the ...
Bob's user avatar
  • 117
0 votes
0 answers
28 views

pandas read_sql: Exclude null values from a select statement to a database call using pd.read_sql

I am running a panda read sql select statement and wish to exclude rows from my output where a certain field is NULL. In standard SQL (Oracle, mySql, ms_sql) I would use where field_name is not null. ...
SCH_245's user avatar
1 vote
2 answers
62 views

Is there a way to add a feature/column to an SQL table from a pandas dataframe?

I have a pandas dataframe with two columns, PaymentID and WasDenied. I want to add that WasDenied column to my SQL table "Payments" by merging on the PaymentID column. Is there any way to do ...
Yisroel Len's user avatar
-2 votes
4 answers
71 views

how to fetch recent row less than the actual date when merged with another table in sql

Consider I have a table which has a date column that is generated everyday as given below. table 1 ID name qty date 1 abc 20 17/01/2022 1 abc 10 18/01/2022 2 def 10 24/01/...
arawind73's user avatar
0 votes
0 answers
43 views

Error while inserting rows into db ORA-00904: "DELETED": invalid identifier, as I am trying to insert into oracle from a csv?

df = pd.read_csv (r"csv2.csv") df = df.dropna () dfx=df[['NOLOADCOST','COLDSTARTUPCOST','INTERSTARTUPCOST','HOTSTARTUPCOST']] import os, oracledb, csv, pyodbc TNS_Admin = os.environ.get('...
arsham vosoughinia's user avatar
0 votes
1 answer
35 views

Python merge/join/concat with boolean condition

I would translate this SQL code (see below) in python code. I think I can use pandas.merge/join but I don't know how define the boolean condition. create table gg as select b.*, a.value from table b ...
Pex82's user avatar
  • 1
0 votes
2 answers
73 views

Find 18 Month Gaps in Invoice Data with SQL

I need help with this SQL query. I have this table that includes every Invoice since 7/1/2020. The table has CustomerID and InvoiceDt in it. For every CustomerID I need to know if there is an 18 month ...
Highflyer999's user avatar
-1 votes
1 answer
62 views

SQL Queries: the most common value in a column grouped by another column

Let's say I have a database employee.db, created as following: # %% CREATE DATAFRAME data = {'Name': ['John', 'Jane', 'Adam', 'Jane', 'Frank', 'Mary'], 'Age': [35, 28, 42, 32, 35, 39], ...
eljamba's user avatar
  • 329

15 30 50 per page
1
2 3 4 5
112