Random. Any Python programmers?

Rum, beer, movies, nice websites, gaming, etc., without interrupting the flow of martial threads.

Random. Any Python programmers?

Postby everything on Sat Dec 10, 2016 11:36 am

Especially if you're using Flask and Pandas?
amateur practices til gets right pro til can't get wrong
/ better approx answer to right q than exact answer to wrong q which can be made precise /
“most beautiful thing we can experience is the mysterious. Source of all true art & science
User avatar
everything
Wuji
 
Posts: 8325
Joined: Tue May 13, 2008 7:22 pm
Location: USA

Re: Random. Any Python programmers?

Postby origami_itto on Sat Dec 10, 2016 11:37 am

I prefer Django, but whatever. What's the deal
The form is the notes, the quan is the music
Free Tai Chi Classes |
Atomic Taijiquan|FB|YT|
Twitch
User avatar
origami_itto
Wuji
 
Posts: 5236
Joined: Wed Oct 05, 2016 10:11 pm
Location: Palm Bay, FL

Re: Random. Any Python programmers?

Postby everything on Sat Dec 10, 2016 2:11 pm

Just need to pass uploaded CSV to Pandas. Rather new at this. Using Flask-Excel.
amateur practices til gets right pro til can't get wrong
/ better approx answer to right q than exact answer to wrong q which can be made precise /
“most beautiful thing we can experience is the mysterious. Source of all true art & science
User avatar
everything
Wuji
 
Posts: 8325
Joined: Tue May 13, 2008 7:22 pm
Location: USA

Re: Random. Any Python programmers?

Postby origami_itto on Sat Dec 10, 2016 3:25 pm

The form is the notes, the quan is the music
Free Tai Chi Classes |
Atomic Taijiquan|FB|YT|
Twitch
User avatar
origami_itto
Wuji
 
Posts: 5236
Joined: Wed Oct 05, 2016 10:11 pm
Location: Palm Bay, FL

Re: Random. Any Python programmers?

Postby TrainingDummy on Sat Dec 10, 2016 3:34 pm

For simple automation scripts and infosec use cases, yes. Don't know anything about Pandas
User avatar
TrainingDummy
Great Old One
 
Posts: 603
Joined: Tue Mar 03, 2009 2:08 pm

Re: Random. Any Python programmers?

Postby everything on Sat Dec 10, 2016 5:20 pm



Yes, see http://flask-excel.readthedocs.io/en/latest/

The first part of the example does a jsonify to return JSON of the csv back to the browser. I just want to send it right to Pandas. Pandas has read csv but I don't want to upload the file, put it on disk, then read from disk, necessarily. Don't necessarily want to put it in a database, either. For now, just want to upload and start using Pandas. I realize I can do this locally in Jupyter or whatever but eventually (assuming I can learn fast enough), this will be a web app first for me, then for others.

Thanks for any tips. This is better than stack overflow, haha. RSF comes through again.
amateur practices til gets right pro til can't get wrong
/ better approx answer to right q than exact answer to wrong q which can be made precise /
“most beautiful thing we can experience is the mysterious. Source of all true art & science
User avatar
everything
Wuji
 
Posts: 8325
Joined: Tue May 13, 2008 7:22 pm
Location: USA

Re: Random. Any Python programmers?

Postby everything on Sat Dec 10, 2016 5:21 pm

TrainingDummy wrote:For simple automation scripts and infosec use cases, yes. Don't know anything about Pandas


cool yeah. I don't know anything about infosec. Pandas is "panel data" for data analysis.
amateur practices til gets right pro til can't get wrong
/ better approx answer to right q than exact answer to wrong q which can be made precise /
“most beautiful thing we can experience is the mysterious. Source of all true art & science
User avatar
everything
Wuji
 
Posts: 8325
Joined: Tue May 13, 2008 7:22 pm
Location: USA

Re: Random. Any Python programmers?

Postby origami_itto on Sat Dec 10, 2016 6:10 pm

everything wrote:


Yes, see http://flask-excel.readthedocs.io/en/latest/

The first part of the example does a jsonify to return JSON of the csv back to the browser. I just want to send it right to Pandas. Pandas has read csv but I don't want to upload the file, put it on disk, then read from disk, necessarily. Don't necessarily want to put it in a database, either. For now, just want to upload and start using Pandas. I realize I can do this locally in Jupyter or whatever but eventually (assuming I can learn fast enough), this will be a web app first for me, then for others.

Thanks for any tips. This is better than stack overflow, haha. RSF comes through again.


Those two pages have the meat of it. You can basically copypasta the code on the upload page, then put in a panda.read_csv() and however you want to display it in the return. I'm not overly familiar with pandas, i usually just put anything and everything in MySql.
The form is the notes, the quan is the music
Free Tai Chi Classes |
Atomic Taijiquan|FB|YT|
Twitch
User avatar
origami_itto
Wuji
 
Posts: 5236
Joined: Wed Oct 05, 2016 10:11 pm
Location: Palm Bay, FL

Re: Random. Any Python programmers?

Postby everything on Sat Dec 10, 2016 6:33 pm

doesn't the read_csv() need to be for a local file? I feel like I should skip the read/write to file or db. But maybe that is silly.
amateur practices til gets right pro til can't get wrong
/ better approx answer to right q than exact answer to wrong q which can be made precise /
“most beautiful thing we can experience is the mysterious. Source of all true art & science
User avatar
everything
Wuji
 
Posts: 8325
Joined: Tue May 13, 2008 7:22 pm
Location: USA

Re: Random. Any Python programmers?

Postby origami_itto on Sat Dec 10, 2016 6:38 pm

Yeah. On the upload you can either store the file locally or pass it to the function as a file like object in memory.
The form is the notes, the quan is the music
Free Tai Chi Classes |
Atomic Taijiquan|FB|YT|
Twitch
User avatar
origami_itto
Wuji
 
Posts: 5236
Joined: Wed Oct 05, 2016 10:11 pm
Location: Palm Bay, FL

Re: Random. Any Python programmers?

Postby origami_itto on Sat Dec 10, 2016 6:42 pm

file like object
file = request.files['file']

Save as local file
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
The form is the notes, the quan is the music
Free Tai Chi Classes |
Atomic Taijiquan|FB|YT|
Twitch
User avatar
origami_itto
Wuji
 
Posts: 5236
Joined: Wed Oct 05, 2016 10:11 pm
Location: Palm Bay, FL

Re: Random. Any Python programmers?

Postby everything on Sat Dec 10, 2016 9:28 pm

ok thanks!
amateur practices til gets right pro til can't get wrong
/ better approx answer to right q than exact answer to wrong q which can be made precise /
“most beautiful thing we can experience is the mysterious. Source of all true art & science
User avatar
everything
Wuji
 
Posts: 8325
Joined: Tue May 13, 2008 7:22 pm
Location: USA

Re: Random. Any Python programmers?

Postby mrtoes on Sun Dec 11, 2016 10:23 am

Who needs Stackoverflow huh?
mrtoes
Wuji
 
Posts: 1351
Joined: Thu Jun 05, 2008 5:06 am
Location: Central America

Re: Random. Any Python programmers?

Postby everything on Sun Dec 11, 2016 10:49 am

mrtoes wrote:Who needs Stackoverflow huh?


You can get so many OTT questions answered here LOL
amateur practices til gets right pro til can't get wrong
/ better approx answer to right q than exact answer to wrong q which can be made precise /
“most beautiful thing we can experience is the mysterious. Source of all true art & science
User avatar
everything
Wuji
 
Posts: 8325
Joined: Tue May 13, 2008 7:22 pm
Location: USA

Re: Random. Any Python programmers?

Postby everything on Sun Dec 11, 2016 2:42 pm

ok I got my csv uploaded a a list of lists. very, very random, but does anyone here use the Pandas (data analysis) library?

Edit: figured it out. It's all easy (after you know).
Last edited by everything on Mon Dec 12, 2016 12:00 pm, edited 1 time in total.
amateur practices til gets right pro til can't get wrong
/ better approx answer to right q than exact answer to wrong q which can be made precise /
“most beautiful thing we can experience is the mysterious. Source of all true art & science
User avatar
everything
Wuji
 
Posts: 8325
Joined: Tue May 13, 2008 7:22 pm
Location: USA


Return to Off the Topic

Who is online

Users browsing this forum: No registered users and 65 guests