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
OLS model in Python; how to find correlation between gender and 20 specific diseases?

Apologies for the bad explanations, I am really confused and clueless.

As the title states, I am trying to find the correlation but I am having some difficulties with the work before running the model.

I have male, female, 20 different diseases "as the columns" and patients on the rows. I have "dummied" it down to 0.0 or 1.0,
ex:

Male Female D1 D2

P1 0.0 , 1.0 , 0.0 , 1.0

P1 is female with disease D2.

I want to use the model to find which disease(s) have a higher correlation to males.

Now I am clueless to the steps to find the correlation....For the first time, I would appreciate answers which is "dummyed" down for me hehehe

/r/pystats
https://redd.it/6z8tyl
How do you distribute your app?

I finally made my way to finalize the first version of my web app! Now the question I'm struggling with is: how do I distribute it?

The app (Django + Django Rest Framowork + client with tons of JS) is of the "final product" type (not a Django reusable app) with, obviously, dependencies. It is supposed to be simply deployed on a host and served by a HTTP server.

When I deploy a PHP web app on a server, I am used to deal with a single archive containing all the necessary files. I thought it'd be the same for a Django app, but I don't know how to handle the dependencies.

So far, the suggestions I've read are the following:

* Create a Docker container. Seems neat, but a bit overkill;
* Create a system package (RPM, DEB). Still overkill;
* Create a Python package with setuptools. Many posts on SO suggest to go this way. Why? For me, it doesn't make sense: as I said, the app is a "final product," there is no point to install it as a regular package (nor point to import it in another project). Moreover, dependencies are not included in the archive. And, if installed, how do I edit local settings?
* Create a all-in-one Python package with PyInstaller. Seems overkill as Python should be available on a server. And I had a hard time to get it working;
* Do nothing, just create an archive of the repo, with no dependencies, and put documentation to set the project up.

I'm very perplex. What should I do?

/r/django
https://redd.it/6zbdi8
DjangoCon 2017 Videos are up and a question!

Firstly, I know a lot of people have been waiting, but the [recordings from DjangoCon 2017 are finally up!](https://www.youtube.com/channel/UC0yY6a79pPY9J0ShIHRf6yw/videos)

Secondly, I want to know from you, the community, what would you like to see covered next year?

/r/djangolearning
https://redd.it/6yio0r
Extract data from invoices?

Hi, I’m trying to automate some tedious parts of my work but I don’t know exactly how to go about doing so.

I get a lot of invoices from several companies who all have different designs and types, some will be an excel spreadsheet converted to a pdf and some will be a scanned document, but I need to extract some information from them.

I don’t need all the data from the invoices and there are certain areas where the data is or certain keywords I could use to find the data.

What would be the best way to go about doing this?

/r/Python
https://redd.it/6zd6ui
New to Django, how do i know which imports i need and where do i found or learn them?

I am new to Django and Python, and this is the first time that i am learning and using a Framework (MVT). My question is, how do i know which kind of imports i need when using Django?
Example: from django.conf.urls import url
How do i know i need to include it. I learned some PHP and i didn't have to import classes/functions manually?
How do i learn what i need and where can i find what i need? Isn't this a bit to complex, why do i need to add and import everything manually?

/r/djangolearning
https://redd.it/6zed09
I made a hacker news clone for practice

I post the Pinterest clone about a week ago, now its the time for me to post a [hacker news clone](https://hnews-clone.herokuapp.com/) and I don't know but I think it's much better than my last one app who doesn't allow you to sign up and the CBV login view don't have any style class

I use bootstrap for this one, and I think, the only issue is my cancel button when I try to delete because doesn't redirect to the detail view again and give an error. And maybe add a pagination after 30 items.

Well, tell me anything or suggest me another app to build

[github](https://github.com/iKenshu/hnews)

/r/django
https://redd.it/6zewgx
Detailed Flask Web Development Series

Hey guys,

I’ve been working on building a really detailed course around the Flask framework to get many beginners started with web development with Python.

Course Page: https://www.thecodewolf.com/courses/python-flask-web-development/

Here are the first few videos of the series, I’ve also have written tutorials with the videos as well:

* Overview & Installation
* [Video](https://youtu.be/Ty2qAlDsAxc)
* [Blog Post](https://www.thecodewolf.com/introduction-to-python-flask-web-development-overview-of-flask/)
* Hello World & Flask Application Structure
* [Video](https://youtu.be/OrTWfZpv0i0)
* [Blog Post](https://www.thecodewolf.com/python-flask-web-development-hello-world-flask-application-structure/)
* Flask Templates, Jinja2 Tutorial, Bootstrap Integration, and Custom Error Pages
* [Video](https://youtu.be/0M74EGmqWIY)
* [Blog Post](https://www.thecodewolf.com/python-flask-web-development-flask-templates-and-flask-bootstrap-integration/)

The next few videos and guides will be coming out in the next few days/weeks, and I’ll be releasing new content on a regular basis.

**My goal is to create the best foundational web development course with the Flask framework to get as many people started with Flask as a stepping stone in web development with Python.**

If you guys enjoy the content, I will also be working on a detailed series like this with Django as well.

Here are some of the following videos that will be coming up with the series:

* Web Forms with Flask
* Database Integrations with Flask

Then I will be working on content that will actually have you build a complete blog application with users, blog posts, and all sorts of other really cool stuff.

With the current content so far, I would love to hear some feedback as well.

~ CW

/r/flask
https://redd.it/6zihsb
Django User's Sessions

So I don't have a DB full of users but have a third party company that contains all my customer data in a DB like users' login credentials. If I am using an API to query the user's data what would be the best practice for creating a users session. like 'django.contrib.sessions' does with the creation of users.
As of now, I can create new users using a form that salts and hashes password, POSTing them to the Third Party companies DB using their API but I don't know how to create a session for the user after I authenticate them.

The API has an SDK for this but it's in PHP thinking everyone would use WordPress. but I won't go that route.

HELP ME GET MY PONIES.

/r/django
https://redd.it/6ziw1d
URL Confusion

I am following the django tutorial of thenewboston on Youtube. In tutorial number 12 he goes into creating a URL. I understand what the outcome is I just don't understand how it works or how I would write it myself. Here are the URL patterns.

urlpatterns = [
#/music/
url(r'^$', views.index, name='index'),

#/music/2
#This just blew my freaking mind
url(r'^(?P<album_id>[0-9]+)/$', views.detail, name="detail"),
]
If someone could help explain to me how the second URL works or point me towards an article that would explain it I would be very appreciative.

/r/djangolearning
https://redd.it/6zk5tn