Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
55 views

I am trying to create a new column using pandasql for my requirement and need to read month of current date but this is not working for me I have a simple dataframe created as below import pandas as ...
Sandeep's user avatar
  • 11
0 votes
1 answer
77 views

CONTEXT I have a DataFrame I'm trying to filter using multiple different conditions / "rulesets". There are 3 different rules with a set of conditions as follows: Rule_DF Variable ...
KL_'s user avatar
  • 331
0 votes
1 answer
101 views

I am using Power BI to connect to a Python Script. Within this Python Script I am utilizing PandaSql and SQLDF. I am taking this approach as I need to manipulate an excel file with SQL queries. ...
user23394390's user avatar
0 votes
0 answers
82 views

So I have been trying to achieve the function that a table will automatically update based on two dcc.Input boxes. So there are two input boxes, one is minimum value and the other is maximum value. I ...
Troy Zhang's user avatar
1 vote
0 answers
101 views

I'm trying to get a list of movies from Steven Spielberg, but for some reason the query in Pandas returns an empty DataFrame, although I know for sure that the table contains Steven Spielberg movies. ...
Amaliya's user avatar
  • 11
0 votes
0 answers
85 views

I'm working with a DataFrame called movies that contains information about movies and their genres (among other features). The genres are comma separated and the column can contain multiple keywords (...
Roline's user avatar
  • 1
-3 votes
1 answer
43 views

I have the following data table: df = pd.DataFrame({'Well': ['A', 'A', 'B', 'B'], 'BP': [380., 25., 24., 360.], 'ng': [1., 10., 1., 10.], 'Band ...
Lewis's user avatar
  • 15
0 votes
0 answers
255 views

I am getting this error message **Error Message: ** pysqldf("SELECT * FROM em_tweets;") pysqldf("SELECT * FROM em_tweets;") InterfaceError Traceback (...
G M Fahim Mugdho's user avatar
1 vote
1 answer
204 views

Building SQL code in Python platform using 'from pandasql import sqldf'. Executed code below and it turned out to be "no such table df" as output. Anyone able to rectify it? query="&...
Tong's user avatar
  • 41
1 vote
2 answers
539 views

I have two data frames as below, listCode= ['A1','A2','A3','A4','A5','A6'] dfLookup = pd.DataFrame({'ID':listCode}) data = [['Chicago', 'B1'], ['Madsion', 'A1'], ['NY', 'A4']] dftest =...
Ullan's user avatar
  • 1,027
4 votes
1 answer
4k views

I have a pandas dataframe called df. Doing a standard SQL query using pandasql. However, it gives me the following error: ObjectNotExecutableError: Not an executable object: 'SELECT * FROM df' from ...
Katsu's user avatar
  • 9,075
0 votes
1 answer
1k views

I am trying to run the below code, but eventually not able to run it in Jupyter notebook. from IPython.display import display from sklearn import datasets import data as data import numpy as nm import ...
Rajdeep's user avatar
  • 21
0 votes
1 answer
946 views

This started after I updated my data science libraries to the latest version. Now I get his error after running any of the queries I was running before, but I'm not completly certain from which ...
Jorge Trindade's user avatar
0 votes
1 answer
421 views

I would like to create a query that performs as the following query suggests, but have no idea what to substitute for parameterA, parameterB, parameterC, or parameterD as far as syntax goes. It ...
noobie's user avatar
  • 31
22 votes
3 answers
28k views

I have a problem with following code: from pandasql import sqldf import pandas as pd df = pd.DataFrame({'column1': [1, 2, 3], 'column2': [4, 5, 6]}) query = "SELECT * FROM df WHERE column1 > ...
ciavam's user avatar
  • 223
-1 votes
1 answer
204 views

I am using pandasql to update or replace values in columns using an ID from another table. I have two tables one that I am trying to update or replace the values Table A id start_destination ...
reksapj's user avatar
  • 101
0 votes
1 answer
704 views

The following code when run import pandas as pd from pandasql import sqldf df = pd.DataFrame({'col1': [1, 2, 3, 4], 'col2': [10, 20, 30, 40]}) query = "SELECT * FROM df WHERE col1 > 2" ...
PaulS's user avatar
  • 27.1k
3 votes
2 answers
6k views

I need to pandasql library for doing some queries on my pandas dataframes. I have run the below code on a simple sample and got the following Error. Strangely, can't consider it as a query! I tried to ...
Amin Khodamoradi's user avatar
1 vote
1 answer
66 views

I´m using pandasql library in Python to make an special query of DataFrames, I trying to make a new row number column from the combination of some columns. I have the next example: tabla_1= pd....
Julio Ortegón's user avatar
0 votes
1 answer
514 views

I have three pandas dataframes and i would like to use SQL to join them together. i have a question on how i assign 'con' in pd.read_sql_query function. import pandas as pd df1 = pd.read_csv("C:/...
kaispace30098's user avatar
0 votes
1 answer
324 views

Having trouble with cast syntax. I get an error message with this and I am having trouble figuring out what the problem is. I'm using pandasql. SELECT CAST((((male_year_df.total_male_suicides) / ...
Bijan Khair Rahman's user avatar
0 votes
1 answer
95 views

I have a date_from and date_to . I want to get the list of dates in between these two dates, grouped by version. version date_from date_to ver1 2020-01-05 2020-01-07 ver2 2021-05-09 2021-05-11 ver1 ...
Lana's user avatar
  • 3
0 votes
2 answers
298 views

I am running a process that checks to see if a row value is numeric. If it is not numeric, a column called 'Flag' is updated with the keyword 'Error' I can do this in SQL using the ISNUMERIC function. ...
smitty_werben_jagerm's user avatar
1 vote
1 answer
658 views

I want to calculate the standard deviation of a field called QUANTITY in my data using pandasql. The problem is that pandasql does not have STD, STDEV, or anything else like that supported. I want to ...
Ravaal's user avatar
  • 3,369
0 votes
0 answers
30 views

I am trying to calculate the time delta between two timestamps and getting only time delta rounded to days. The difference in hours, minutes, or seconds is gone (this is not a case of multiplying by ...
imtherealmikey1's user avatar
0 votes
2 answers
388 views

I have a case problem like this (pandasql): Find cities in the United States (uscity) that meet all of the following conditions: has the name 'city' which is not the same as 'state_name', and also ...
Tyovendi Arisandy's user avatar
-3 votes
1 answer
834 views

I currently try to merge two DataFrames by using pandasql, but I don't know how to create a new column for my DataFrame. I tried the code "ALTER TABLE crsp ADD monthid INT()", and it told me ...
Jeremy's user avatar
  • 1
1 vote
1 answer
350 views

I'm using pandasql to get data from df1. Can I assign the output of query to new column in df2? I tried (df2['grade']=ps.sqldf(sqlcode,locals())) but this didn't work, which was expected because query ...
Zaur Guliyev's user avatar
0 votes
1 answer
707 views

I have this function: def sentiment_review(query, maxresults): . . . positive_tweets = pds.sqldf("select count(sentiment)as n from df where sentiment = 'POSITIVE'")['n'].iloc[...
Itamar B's user avatar
0 votes
1 answer
646 views

This is a problem that took me a long time to solve, and I wanted to share my solution. Here's the problem. We have 2 pandas DataFrames that need to be outer joined on a very complex condition. Here ...
v4gil's user avatar
  • 951
-1 votes
1 answer
612 views

According to this answer: https://stackoverflow.com/a/25863597/12304000 We can use something like this in mysql to calculate the time diff between two cols: SELECT TIMESTAMPDIFF(<INTERVAL>,<...
x89's user avatar
  • 3,532
1 vote
0 answers
357 views

I'm Lucas and I'm a master student in management science in Belgium. I have a very poor background in coding and everything related to it, so my problem is probably very basic but still very confusing ...
Lucas Leblond's user avatar
0 votes
1 answer
370 views

I have a csv file. I need to remove the duplicates values under street_name. ex: I have multi hwy-1w! I used this query: joinedResult.groupby('roadId')['street_name'].apply(', '.join).reset_index()....
Tara's user avatar
  • 5
0 votes
2 answers
200 views

I wanna pick cities from worldcity by these conditions: the population of the city exceeds the population of the most populous city in the Filipina. (Meaning: for example city X is the city in the ...
Akbar Amelia's user avatar
0 votes
1 answer
1k views

I have two files - df.pkl and df.ftr. And I am using run_qry = lambda q: sqldf(q, globals()) to run sql queries. So for example: I am creating a new DataFrame like new_dfr = run_qry("""...
Satyam676's user avatar
0 votes
0 answers
666 views

I am getting table from oracle database and converted that into pandas DataFrame (df).I access this dataframe into my summary function and create a new dataframe (crit_df) from it. Till here ...
Satyam676's user avatar
1 vote
1 answer
406 views

I have this data frame, where id is an int64, and date is datetime64[ns]: id date 0 1811302 2017-03-08 00:00:00.000000 1 16095 2013-03-12 00:00:00.000000 2 ...
Martien Lubberink's user avatar
0 votes
1 answer
390 views

I know this is an old topic but I keep having trouble with installing pandasql in anaconda, I hope someone could help... what I have tried: open anaconda prompt, type pip install pandasql, then I got ...
FFFFFfunguy's user avatar
0 votes
0 answers
781 views

I'm trying to get the difference between two dates in Pandasql (using a dataframe as table), But it doesn't work. the code: query3 = ''' SELECT user_id , transaction_id , amount_in_eur , min(...
Sérgio Fernandes's user avatar
0 votes
1 answer
4k views

import pandas as pd from pandasql import sqldf class ABC: def __init__(self): self.details = {'Name' : ['Ankit', 'Aishwarya', 'Shaurya', 'Shivangi'],'Age' : [23, 21, 22, 21]} self.df =...
siddhartha jain's user avatar
0 votes
1 answer
661 views

Hay Everyone I am trying to translate my SQL server query into pandasql so the task is to get the average time (in minutes) between 2 process this is my query on the SQL server select payment_method,...
Lix Felix's user avatar
0 votes
2 answers
63 views

I'm trying to put an sql query in a string using pandasql pulled from AI's GPT-3. the query is SELECT * FROM netflix WHERE release_year = 2020 AND type = 'Movie' AND listed_in LIKE '%Horror% What i ...
Paul Smith's user avatar
0 votes
0 answers
315 views

How can we execute sql in python pandas : SQL : select a.*, b.vol1 / sum(vol1) over ( partition by a.sale, a.d_id, a.month, a.p_id ) vol_r, a.vol2* b.vol1/ sum(b.vol1) over ( partition by a....
NITIN KOTHARI's user avatar
1 vote
0 answers
292 views

My Pandas Dataframe named as data_five_minutes: script_id date_time open 0 1 2019-01-11 09:35:00 25 1 1 2019-01-11 09:40:00 30 2 1 2019-01-11 09:45:00 48 Full ss: Now I was trying to get only data ...
Kabomi's user avatar
  • 121
1 vote
1 answer
1k views

So I am kind of new to Python, and for the life of me I cannot figure this out. I am using spyder with anaconda and this specific module, pandasql, I am unable to locate. I go to the environment ...
Vector Reeves's user avatar
1 vote
0 answers
364 views

I have some code in such a way within a .py file let's call A.py: from B import create_dummy_df, sqldf_function a = create_dummy_df() query = """ select * from a """ b ...
rluo's user avatar
  • 85
0 votes
1 answer
121 views

I used to have a simple row and column format in table and was reading it by pandassql . but if you have structure like below and want to get age>10 from this , how do I get it using pandassql? ...
user15780176's user avatar
2 votes
0 answers
1k views

I am trying to query the pandas data frame with SQL syntax. I imported "import pandasql as ps", and loaded a dataframe. Then i entered this simple syntax: ps.sqldf( """ ...
yts61's user avatar
  • 1,669
0 votes
2 answers
1k views

I'm getting the following 'Python int too large to convert to SQLite INTEGER' error when I run my code. I'm a beginner with psql. Code: import pandas as pd import numpy as np import pandasql as psql ...
covershaker's user avatar
-1 votes
1 answer
124 views

I am new to python and I am using pandasql to perform condition-based joins: from pandasql import sqldf pysqldf = lambda q: sqldf(q, globals()) q = """ SELECT * FROM ...
anil tiwari's user avatar

1
2 3 4 5