implementing sqlite sort by function and select function together in python along with pandas Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!mkdir -p functionality in PythonComparing sql valuesWhy does Python code run faster in a function?Selecting multiple columns in a pandas dataframeUse a list of values to select rows from a pandas dataframeAdding new column to existing DataFrame in Python pandasSelect rows from a DataFrame based on values in a column in pandasPython threading, why can i launch thread only once?Efficient Python/Pandas Selection and SortingPython Pandas sort by Time and group by user ID
Prove the alternating sum of a decreasing sequence converging to 0 is Cauchy.
Multiple options vs single option UI
Raising a bilingual kid. When should we introduce the majority language?
"Rubric" as meaning "signature" or "personal mark" -- is this accepted usage?
Would reducing the reference voltage of an ADC have any effect on accuracy?
What is the term for a person whose job is to place products on shelves in stores?
A strange hotel
"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"
Does Mathematica have an implementation of the Poisson binomial distribution?
What is a 'Key' in computer science?
What is the best way to deal with NPC-NPC combat?
Is Diceware more secure than a long passphrase?
Is accepting an invalid credit card number a security issue?
How to avoid introduction cliches
Seek and ye shall find
What's parked in Mil Moscow helicopter plant?
Is there any hidden 'W' sound after 'comment' in : Comment est-elle?
Does Feeblemind produce an ongoing magical effect that can be dispelled?
Married in secret, can marital status in passport be changed at a later date?
Passing args from the bash script to the function in the script
"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?
How to keep bees out of canned beverages?
Expansion//Explosion and Siren Stormtamer
Holes in ElementMesh with ToElementMesh of ImplicitRegion
implementing sqlite sort by function and select function together in python along with pandas
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!mkdir -p functionality in PythonComparing sql valuesWhy does Python code run faster in a function?Selecting multiple columns in a pandas dataframeUse a list of values to select rows from a pandas dataframeAdding new column to existing DataFrame in Python pandasSelect rows from a DataFrame based on values in a column in pandasPython threading, why can i launch thread only once?Efficient Python/Pandas Selection and SortingPython Pandas sort by Time and group by user ID
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am writing a program to search through a database. My table contains Id, Title, Date, Content. I only need date and content as output. The output must be sorted with respect to 'Id'. But I don't want Id in output. How can I implement this ?
I tried to sort data before selecting Id and Content, unfortunately it is not giving me desired result.
import os
import pandas as pd
conn = sqlite3.connect('insight.db')
c = conn.cursor()
def search_keyword(term):
c.execute("SELECT * FROM GkData ORDER BY Id DESC")
print(pd.read_sql_query("SELECT date, content FROM GkData WHERE LIKE '%%'".format('content', term), conn))
c.execute("SELECT content FROM GkData WHERE LIKE '%%'".format('content', term))
data = c.fetchall()
for idx, row in enumerate(data):
new_data = str(row).replace("',)", " ").replace("('", " ")
print('[ ' + str(idx) + ' ] =====> ' + new_data)
while True:
search = input("Search term: ")
search_keyword(str(search))
conn.close()
Output image of the program
Image of Table
python pandas sqlite
add a comment |
I am writing a program to search through a database. My table contains Id, Title, Date, Content. I only need date and content as output. The output must be sorted with respect to 'Id'. But I don't want Id in output. How can I implement this ?
I tried to sort data before selecting Id and Content, unfortunately it is not giving me desired result.
import os
import pandas as pd
conn = sqlite3.connect('insight.db')
c = conn.cursor()
def search_keyword(term):
c.execute("SELECT * FROM GkData ORDER BY Id DESC")
print(pd.read_sql_query("SELECT date, content FROM GkData WHERE LIKE '%%'".format('content', term), conn))
c.execute("SELECT content FROM GkData WHERE LIKE '%%'".format('content', term))
data = c.fetchall()
for idx, row in enumerate(data):
new_data = str(row).replace("',)", " ").replace("('", " ")
print('[ ' + str(idx) + ' ] =====> ' + new_data)
while True:
search = input("Search term: ")
search_keyword(str(search))
conn.close()
Output image of the program
Image of Table
python pandas sqlite
add a comment |
I am writing a program to search through a database. My table contains Id, Title, Date, Content. I only need date and content as output. The output must be sorted with respect to 'Id'. But I don't want Id in output. How can I implement this ?
I tried to sort data before selecting Id and Content, unfortunately it is not giving me desired result.
import os
import pandas as pd
conn = sqlite3.connect('insight.db')
c = conn.cursor()
def search_keyword(term):
c.execute("SELECT * FROM GkData ORDER BY Id DESC")
print(pd.read_sql_query("SELECT date, content FROM GkData WHERE LIKE '%%'".format('content', term), conn))
c.execute("SELECT content FROM GkData WHERE LIKE '%%'".format('content', term))
data = c.fetchall()
for idx, row in enumerate(data):
new_data = str(row).replace("',)", " ").replace("('", " ")
print('[ ' + str(idx) + ' ] =====> ' + new_data)
while True:
search = input("Search term: ")
search_keyword(str(search))
conn.close()
Output image of the program
Image of Table
python pandas sqlite
I am writing a program to search through a database. My table contains Id, Title, Date, Content. I only need date and content as output. The output must be sorted with respect to 'Id'. But I don't want Id in output. How can I implement this ?
I tried to sort data before selecting Id and Content, unfortunately it is not giving me desired result.
import os
import pandas as pd
conn = sqlite3.connect('insight.db')
c = conn.cursor()
def search_keyword(term):
c.execute("SELECT * FROM GkData ORDER BY Id DESC")
print(pd.read_sql_query("SELECT date, content FROM GkData WHERE LIKE '%%'".format('content', term), conn))
c.execute("SELECT content FROM GkData WHERE LIKE '%%'".format('content', term))
data = c.fetchall()
for idx, row in enumerate(data):
new_data = str(row).replace("',)", " ").replace("('", " ")
print('[ ' + str(idx) + ' ] =====> ' + new_data)
while True:
search = input("Search term: ")
search_keyword(str(search))
conn.close()
Output image of the program
Image of Table
python pandas sqlite
python pandas sqlite
edited Mar 9 at 6:25
ksananthu
asked Mar 9 at 6:15
ksananthuksananthu
103
103
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
"The output must be sorted with respect to 'Id'. But I don't want Id in output. How can I implement this ?"
SELECT date, content FROM GkData WHERE content LIKE %something% ORDER BY id ASC
@ baldermanSELECT date, content FROM GkData ORDER BY id ASC WHERE content LIKE %new%
is not working. I need to combine sorting and search. If i do sorting alone it is working.
– ksananthu
Mar 9 at 11:21
see the code change - the ORDER BY is after the WHERE
– balderman
Mar 9 at 11:43
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074589%2fimplementing-sqlite-sort-by-function-and-select-function-together-in-python-alon%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
"The output must be sorted with respect to 'Id'. But I don't want Id in output. How can I implement this ?"
SELECT date, content FROM GkData WHERE content LIKE %something% ORDER BY id ASC
@ baldermanSELECT date, content FROM GkData ORDER BY id ASC WHERE content LIKE %new%
is not working. I need to combine sorting and search. If i do sorting alone it is working.
– ksananthu
Mar 9 at 11:21
see the code change - the ORDER BY is after the WHERE
– balderman
Mar 9 at 11:43
add a comment |
"The output must be sorted with respect to 'Id'. But I don't want Id in output. How can I implement this ?"
SELECT date, content FROM GkData WHERE content LIKE %something% ORDER BY id ASC
@ baldermanSELECT date, content FROM GkData ORDER BY id ASC WHERE content LIKE %new%
is not working. I need to combine sorting and search. If i do sorting alone it is working.
– ksananthu
Mar 9 at 11:21
see the code change - the ORDER BY is after the WHERE
– balderman
Mar 9 at 11:43
add a comment |
"The output must be sorted with respect to 'Id'. But I don't want Id in output. How can I implement this ?"
SELECT date, content FROM GkData WHERE content LIKE %something% ORDER BY id ASC
"The output must be sorted with respect to 'Id'. But I don't want Id in output. How can I implement this ?"
SELECT date, content FROM GkData WHERE content LIKE %something% ORDER BY id ASC
edited Mar 9 at 11:42
answered Mar 9 at 6:56
baldermanbalderman
2,00211420
2,00211420
@ baldermanSELECT date, content FROM GkData ORDER BY id ASC WHERE content LIKE %new%
is not working. I need to combine sorting and search. If i do sorting alone it is working.
– ksananthu
Mar 9 at 11:21
see the code change - the ORDER BY is after the WHERE
– balderman
Mar 9 at 11:43
add a comment |
@ baldermanSELECT date, content FROM GkData ORDER BY id ASC WHERE content LIKE %new%
is not working. I need to combine sorting and search. If i do sorting alone it is working.
– ksananthu
Mar 9 at 11:21
see the code change - the ORDER BY is after the WHERE
– balderman
Mar 9 at 11:43
@ balderman
SELECT date, content FROM GkData ORDER BY id ASC WHERE content LIKE %new%
is not working. I need to combine sorting and search. If i do sorting alone it is working.– ksananthu
Mar 9 at 11:21
@ balderman
SELECT date, content FROM GkData ORDER BY id ASC WHERE content LIKE %new%
is not working. I need to combine sorting and search. If i do sorting alone it is working.– ksananthu
Mar 9 at 11:21
see the code change - the ORDER BY is after the WHERE
– balderman
Mar 9 at 11:43
see the code change - the ORDER BY is after the WHERE
– balderman
Mar 9 at 11:43
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074589%2fimplementing-sqlite-sort-by-function-and-select-function-together-in-python-alon%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown