Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
I made an application which shows a new motivational quote every 2 minutes.

/r/Python
https://redd.it/cf3n3v
[P] I made a video review of The Hundred-Page Machine Learning Book

I enjoy learning about machine learning.

And I enjoy making videos.

So I made a video reviewing [The Hundred-Page Machine Learning Book](https://themlbook.com) by Andriy Burkov.

I read it from the perspective of a machine learning engineer and still learned a bunch.

If you haven't checked out the book, it's a great concise read. There's nothing like a complex topic explained simply.

If you do watch the video, any advice on ways to improve or future reviews/topics would be greatly appreciated.

[https://youtu.be/btLxTTkSZuY](https://youtu.be/btLxTTkSZuY)

/r/MachineLearning
https://redd.it/cf4rh5
[P] Comprehensive Machine Learning Trading Strategies - Google Colab

100+ Machine Learning Trading Strategies

[https://github.com/firmai/machine-learning-asset-management](https://github.com/firmai/machine-learning-asset-management)

​

\- Deep Learning

\- Reinforcement Learning

\- Evolutionary Strategies

\- Stacked Models

/r/MachineLearning
https://redd.it/cf111a
How to link Flask static files?

I am making a basic blog using HTML,and CSS. I linked my HTML file but I am having trouble linking the CSS.

This is the following code:

from flask import Flask,render_template,url_for

app = Flask(__name__)

@app.route('/')
def hello_world():
return render_template('home.html'), url_for('static', filename='main.css')

Thanks,

/r/flask
https://redd.it/cf7zr4
Is there a tutorial around to make a reddit like site?

I've googled it but keep finding reddit threads about making django sites. I would like to make something like reddit, but not sure where to start. Having a guide or tutorial I could follow would help a lot.

/r/django
https://redd.it/cfbapi
Pythonanywhere email send does not work

So I just released my site on Pythonanywhere, but one of my features is not working. A user presses a button after filling out a form, and then the data is saved to my admin (which works) and an email is supposed to send to out me and the user. However, the email is not going out. When I try it on my local machine with the same code, it works, but on the pythonanywhere it doesnt.

/r/django
https://redd.it/cfgffy
Updating static files?

So currently, the only way I can get changes to static files to take in my app is to add version numbers to my <link> like so:

<link href="{url_for('static', filename='css/style.css', version='30')}" rel="stylesheet">

But this can get tedious if you're just making incremental changes while testing. So is there a better way to update my static files and have them take effect without constantly changing the version number?

/r/flask
https://redd.it/cf9lrp
Pure Python Implementation of 100+ Stock Trading Strategies - Google Colab

I have always held the belief that one of the best ways to learn about data-science/python is to find problems to solve in finance where the data is plentiful.

I will add the list here so that you won't have to go to GitHub or the SSRN file. It is a list of a few strategies and some portfolio optimisation techniques. They all have an ML bent. Like before any criticism and feedback is highly appreciated.

Source: [https://github.com/firmai/machine-learning-asset-management](https://github.com/firmai/machine-learning-asset-management)

**1. Tiny CTA**
*Resources*:
See this [paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2695101) and [blog](https://www.linkedin.com/pulse/implement-cta-less-than-10-lines-code-thomas-schmelzer/) for further explanation.
[Data](http://drive.google.com/open?id=12BB8KpFYJSx41yvHhtoLYE_ZZOHNamP8), [Code](https://drive.google.com/open?id=1EwbHhBZL_PRTphR25EbMQA9dV7jC4CjT)

**2. Tiny RL**
*Resources*:
See this [paper](http://cs229.stanford.edu/proj2006/Molina-StockTradingWithRecurrentReinforcementLearning.pdf) and/or [blog](https://teddykoker.com/) for further explanation.
[Data](https://drive.google.com/open?id=1k7J5y1xCssIna45d_Xw78d2frgzD94Li), [Code](https://drive.google.com/open?id=1IRrR6kWjunERzZqrszJ9_q-C1Yj5L0Qj)

**3. Tiny VIX CMF**
*Resources*:
[Data](https://drive.google.com/open?id=1Yv2_mTjZMANoL9fM0ajOsOFEc9MJZAMU), [Code](https://drive.google.com/open?id=186j-gtkXCgzj06WCWDAU9yhYXP9SfgLu)

**4. Quantamental**
*Resources*:
[Web-scrapers](https://drive.google.com/drive/folders/12aZ7vg_3HIdPYZ4GavYY7BjptlAPGFtc?usp=sharing), [Data](https://drive.google.com/open?id=1b0OXiSKnacEDftYKgov619SCfXwpcUWT), [Code](https://drive.google.com/open?id=1PqtFfcr1ejreGr6XIoZCs8jsD7AccuL7), [Interactive Report](https://github.com/firmai/interactive-corporate-report), [Paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3420490).

**5. Earnings Surprise**
*Resources*:
[Code](https://drive.google.com/open?id=1KtGauKizS8QISuDCW0SwIxbYPeBwTQxF), [Paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3420722)

**6. Bankruptcy Prediction**
*Resources*:
[Data](https://drive.google.com/open?id=1UAIZBNHag-AdWZ4z7nd_y5THQ89D-IQh), [Code](https://drive.google.com/open?id=1Z2ZyvEoWsRfHSa1f7g0m1O-JiXedUdb_), [Paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3420889)

**7. Filing Outcomes**
*Resources*:
[Data](https://drive.google.com/open?id=1cDhrrAp07e-2TgrPQginXUNQpdbTpq-u)

**8. Credit Rating Arbitrage**
*Resources:*
[Code](https://drive.google.com/open?id=1i_yERL4i6qp57C0LdSWEV8iYv_rtAZLF)

**9. Factor Investing:**
*Resources:*
[Paper](https://docplayer.net/120877135-Industry-return-predictability-a-machine-learning-approach.html), [Code](https://drive.google.com/open?id=1O0LQ_khTfsbFG5aN3-AqV6DEIRWQ6UuP), [Data](https://drive.google.com/open?id=1cc43729RyOPCsDJ3r46SdHcJJp1AUmaA)

**10. Systematic Global Macro**
*Resources:*
[Data](https://drive.google.com/open?id=1ePKFtfjBrfg3xDtg_dbssykeSd8ZmA1z), [Code](https://drive.google.com/open?id=10bN3kNjl9EMDB5Tt1ArXO8IaxLiPh_Zd)

**11. Mixture Models**
*Resources*:
[Data](https://drive.google.com/open?id=1jmR2Jlk6Hy7J7c2jZFEK1oXptOHbDYLK), [Code](https://drive.google.com/open?id=1tRIt7lIJErWKwoHIuBS6rZbZo2EYBNTN)

**12. Evolutionary**
*Resources*:
[Code](https://drive.google.com/open?id=116Aj9kbZcrCyR5MDu58HkWE53lacAE52)

**13. Agent Strategy**
*Resources*:
[Code](https://drive.google.com/open?id=1qCvIeui5dJKMXnjUm9_wiPf65VVHdWwz)

**14. Stacked Trading**
*Resources*:
[Code](https://drive.google.com/open?id=11SG9KIWUxV9fgrrpAs0QifgGrcdzk2dh), [Blog](https://www.kdnuggets.com/2017/02/stacking-models-imropved-predictions.html)

**15. Deep Trading**
*Resources*:

/r/Python
https://redd.it/cfevn9
Receiving and then Serving image files

So I get an image file with the following sample URL (http://localhost:8096/image/blah). I would like to then serve this image via a flask route.

So I have at the moment

@app.route('/image/blah')
def __blahimage():
import requests
r = requests.get('http://localhost:8096/image/blah')
#Response 200
return send_file(r.text)

This does not seem to be the correct way. I'm new to Python in general and the reason I'm doing this is because the images are available on a local server only. The flask is a wrapper essentially.

/r/flask
https://redd.it/cfka7t
Is Flask a good fit for this kind of service ?

Hi everyone,

I'm in the very early stages of evaluating the technical options available for an online tool. So far my research showed me that yes, Flask is a good solution. I've always heard good things about it, but I'd like to get some reinsurance from people who work with it on a daily basis.

I play a bit with Python myself but I'm nowhere near a technical guy. I'm probably unaware of the best ways to handle, store, feed and serve large data stream. Pardon in advance any incongruous consideration.

&#x200B;

Here's the big picture : get data from APIs/scraping > do some data wrangling > serve that to a pretty font-end.

Flask can do that as far as I know.

Now at first the features should be basic:

Pull data from APIs > do some parsing & statistical stuff with it (Pandas, Geopandas), feed some dashboards with tables / dynamic graphs, add vector layers to maps.

&#x200B;

From what I understand, for the earlier, more basic phase, I should do fine with a good fullstack dev and a good server and that should be enough to get the thing up and running (+ maintenance), right ?

&#x200B;

Later on some additional tasks could be added, such as:

* scrape

/r/flask
https://redd.it/cflc3p
My Website (Audio Converter) which has a Flask/Python backend.

This is a non-profit website that I work on in my free time. Many formats are supported. No software to download and easy to use.

You can access my website via either of the following URLs:

https://onlineaudioconverter.net

https://freeaudioconverter.net

Feedback is welcome :)

/r/flask
https://redd.it/cfol51
How do you handle dynamic interactions

So I'm building a sass app where my productivity is pretty much my main concern. Since I have extremely limited time server rendered html with Django is my choice. It's going great for me even if I am quite new to the framework.

Problem now is there are a couple cases where I need a bit more interaction. Way back I used to do this with Ruby on Rails with jQuery AJAX where the server returned a small chunk of html that got swapped out on the existing page. I was thinking of doing the same thing again, but I was wondering if anybody has any better solutions or pointers.

I definitely want to minimize JavaScript and absolutely want to avoid adding react and a whole lot of other stuff (state, router, ...) For example. I'm looking for a minimal solution that's quick to develop.

Main use case for me is something like an invoice where the user can add items dynamically. This means some kind of modal pop-up type thing where they can search/filter/sort through items to add the correct one.

Any ideas appreciated!

/r/django
https://redd.it/cfufs9
Flask_debug=1 when running i get this error



does anyone else get this kinda problem,
how to fix it


c:\\python37\\python.exe: No module named C:\\Python37\\Scripts\\flask

/r/flask
https://redd.it/cfabez
I cannot even begin to get %load magic to work without an absolute path.

My personal ‘Scripts’ folder is in both my Path and PYTHONPATH environment variables (Windows), and I can even import files in that directory in Jupyter Lab with no problem.

I’m trying to `%load` a file there called `first_cell.py`. I’ve tried all these variations:

%load first_cell.py
%loadpy first_cell.py
%load first_cell
%loadpy first_cell

I get this error (after a big stack trace):

ValueError: 'first_cell' was not found in history, as a file, url, nor in the user namespace.

or:

ValueError: 'first_cell.py' was not found in history, as a file, url, nor in the user namespace.

Putting the complete absolute path (`%load C:\Users\atimh\Scripts\first_cell.py`) *does* work, but it’s a giant pain. It’s not portable, and it defeats the purpose: it should be something easy to remember and quick to type, else why even do it?

I know I can just run the file, but showing all my preferred imports every time communicates far more clearly what’s going on.

And being forced to stick it in some “special” folder hidden away somewhere is not a good solution. I don’t want to be forced to scatter all my Python scripts to the four winds.

/r/IPython
https://redd.it/cfvgzy
Tried by any possible means to get my first 10 on pylint. Got nuked.

/r/Python
https://redd.it/cfked9