I have a csv with 50k observations and I’m trying to drop every row that contains a “.” In it.
I’ve tried df[column].str.contains(“.”) but it doesn’t seem to work a Series structure. How would I go about removing those rows?
/r/Python
https://redd.it/camd7z
I’ve tried df[column].str.contains(“.”) but it doesn’t seem to work a Series structure. How would I go about removing those rows?
/r/Python
https://redd.it/camd7z
reddit
r/Python - I have a csv with 50k observations and I’m trying to drop every row that contains a “.” In it.
15 votes and 14 comments so far on Reddit
Class based views or function based views?
I want to have a functionality in my django app where a user fills in a form with data, then that data is passed into a function as parameters. From there, the parameters and some other generated values based on input parameters are inserted into multiple sql tables that belong to different models.
​
For now I want to create dummy values that I can pass as parameters and insert into separate tables to test if the function is working and storing data correctly. How should I approach this issue? ( I am a little new to Django)
Thanks in advance for all tips/suggestions!
/r/django
https://redd.it/caqo8r
I want to have a functionality in my django app where a user fills in a form with data, then that data is passed into a function as parameters. From there, the parameters and some other generated values based on input parameters are inserted into multiple sql tables that belong to different models.
​
For now I want to create dummy values that I can pass as parameters and insert into separate tables to test if the function is working and storing data correctly. How should I approach this issue? ( I am a little new to Django)
Thanks in advance for all tips/suggestions!
/r/django
https://redd.it/caqo8r
reddit
r/django - Class based views or function based views?
9 votes and 10 comments so far on Reddit
[Ask Flask] Anyone know the difference between using unittest.main() and using addTest(), then run(suite)?
Hi all, I am testing a flask app and have done this many times before, however this time it is different. I am using the following to run the tests:
suite = unittest.TestSuite()
player1 = dict(BasicTest.player_pairs[0]['player1']
player2 = dict(BasicTest.player_pairs[0]['player2']
suite.addTest(BasicTest('test_player1_loses_money', player1, player2)
runner = unittest.TextTestRunner(verbosity=2=3, failfast=True)
runner.run(suite)
I am doing the above because I will then call addTest() in a loop to test many pairs of players.
The problem is that requests seem to no longer work. I get timeout errors. I am getting exceptions within exceptions. EXCEPTION INCEPTION lol.
HTTPConnectionPool(host='159.89.146.74', port=7076): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f05222e9668>: Failed to establish a new connection: [Errno 110] Connection timed out',))
When I run my test regularly using unittest.main() everything works fine, but I want to run 1 test case many times with different pairs of players.
My flask app is just Restful endpoints and inside those endpoints, I make calls to external services.
Does anyone know why requests is broken when I use addTest() method? I feel like the error is very obscure, I tried looking at
/r/flask
https://redd.it/cavp4m
Hi all, I am testing a flask app and have done this many times before, however this time it is different. I am using the following to run the tests:
suite = unittest.TestSuite()
player1 = dict(BasicTest.player_pairs[0]['player1']
player2 = dict(BasicTest.player_pairs[0]['player2']
suite.addTest(BasicTest('test_player1_loses_money', player1, player2)
runner = unittest.TextTestRunner(verbosity=2=3, failfast=True)
runner.run(suite)
I am doing the above because I will then call addTest() in a loop to test many pairs of players.
The problem is that requests seem to no longer work. I get timeout errors. I am getting exceptions within exceptions. EXCEPTION INCEPTION lol.
HTTPConnectionPool(host='159.89.146.74', port=7076): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f05222e9668>: Failed to establish a new connection: [Errno 110] Connection timed out',))
When I run my test regularly using unittest.main() everything works fine, but I want to run 1 test case many times with different pairs of players.
My flask app is just Restful endpoints and inside those endpoints, I make calls to external services.
Does anyone know why requests is broken when I use addTest() method? I feel like the error is very obscure, I tried looking at
/r/flask
https://redd.it/cavp4m
reddit
r/flask - [Ask Flask] Anyone know the difference between using unittest.main() and using addTest(), then run(suite)?
6 votes and 2 comments so far on Reddit
Heroku/Postgres database migration to Flask
I have a postgres database with a table set up on heroku and I've loaded my data into the database via a csv file. I've been trying to migrate the data from my heroku/postgres database to my flask app and query through some of it but all the tutorials I've read through have me instantiating the database and table within the flask app itself. Is there a way I can query my existing database without having to recreate it within flask itself?
/r/flask
https://redd.it/cavbf4
I have a postgres database with a table set up on heroku and I've loaded my data into the database via a csv file. I've been trying to migrate the data from my heroku/postgres database to my flask app and query through some of it but all the tutorials I've read through have me instantiating the database and table within the flask app itself. Is there a way I can query my existing database without having to recreate it within flask itself?
/r/flask
https://redd.it/cavbf4
reddit
r/flask - Heroku/Postgres database migration to Flask
2 votes and 1 comment so far on Reddit
Built my first web app, tips for documentation?
Hi, I have built my very first blog app by following this tutorial: [Django | Corey MS](https://www.youtube.com/watch?v=UmljXZIypDc&list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p). I have no prior coding experience besides a basic knowledge of Python.
The site is done, and I am very happy with what I have achieved so far. All that is left is adding a few more bells and whistles to the front end, and deployment.
This is my very first Django project, and it has been a fantastic experience. But, I feel like I am losing track of things I have learned. The concepts are still clear, but a lot of techniques that I have learned (from big things like how to create a custom model to little things like how to add django pagination or how to use libraries like pillow) are already blurry or forgotten.
I still haven't learned to use Git. That is my next target.
What is the best way to create a repository of personal documentation that I can refer back to at any time and easily understand what was going on and how things came to be? Code hosting platforms(Github)? Jupyter Notebook? Plain pen and paper? Please don't laugh.
I have a lot of small personal Django projects lined up
/r/djangolearning
https://redd.it/cawjrn
Hi, I have built my very first blog app by following this tutorial: [Django | Corey MS](https://www.youtube.com/watch?v=UmljXZIypDc&list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p). I have no prior coding experience besides a basic knowledge of Python.
The site is done, and I am very happy with what I have achieved so far. All that is left is adding a few more bells and whistles to the front end, and deployment.
This is my very first Django project, and it has been a fantastic experience. But, I feel like I am losing track of things I have learned. The concepts are still clear, but a lot of techniques that I have learned (from big things like how to create a custom model to little things like how to add django pagination or how to use libraries like pillow) are already blurry or forgotten.
I still haven't learned to use Git. That is my next target.
What is the best way to create a repository of personal documentation that I can refer back to at any time and easily understand what was going on and how things came to be? Code hosting platforms(Github)? Jupyter Notebook? Plain pen and paper? Please don't laugh.
I have a lot of small personal Django projects lined up
/r/djangolearning
https://redd.it/cawjrn
YouTube
Python Django Tutorial: Full-Featured Web App Part 1 - Getting Started
In this Python Django Tutorial, we will be learning how to get started using the Django framework. We will install the necessary packages and get a basic application running in our browser. Let's get started...
The code for this series can be found at:
…
The code for this series can be found at:
…
[For Beginners] How Django REST Framework is advantageous over vanilla Django
https://medium.com/@raaj.akshar/why-django-rest-framework-is-needed-over-vanilla-django-fa16296b3477
/r/django
https://redd.it/cb2he8
https://medium.com/@raaj.akshar/why-django-rest-framework-is-needed-over-vanilla-django-fa16296b3477
/r/django
https://redd.it/cb2he8
Medium
How Django REST Framework is advantageous over Vanilla Django
In this post we address the following confusions:
Heroku Chatbot with Celery, WebSockets, and Redis.
https://medium.com/p/340fcd160f06
/r/django
https://redd.it/cb1lpf
https://medium.com/p/340fcd160f06
/r/django
https://redd.it/cb1lpf
Medium
Heroku Chatbot with Celery, WebSockets, and Redis.
Let’s create a Chatbot which can execute tasks asynchronously using Celery and communicate via WebSockets.
Best method to plot time of day independent of date?
I often work data that needs to be plotted by time of day with no regard for the date. Typically I'm just making simple scatter plots of values vs time of day. I have a lot of issues plotting this as actual time so I've been covering time to minutes past midnight for a smooth plot. I'm certain this isn't an affective strategy and . Do y'all have recommendations? Pandas datetime format seems to wreak havoc on any plots I make and always adds a date.
/r/pystats
https://redd.it/cb50kz
I often work data that needs to be plotted by time of day with no regard for the date. Typically I'm just making simple scatter plots of values vs time of day. I have a lot of issues plotting this as actual time so I've been covering time to minutes past midnight for a smooth plot. I'm certain this isn't an affective strategy and . Do y'all have recommendations? Pandas datetime format seems to wreak havoc on any plots I make and always adds a date.
/r/pystats
https://redd.it/cb50kz
reddit
r/pystats - Best method to plot time of day independent of date?
0 votes and 0 comments so far on Reddit
What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/cb1d1q
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/cb1d1q
reddit
r/Python - What's everyone working on this week?
2 votes and 6 comments so far on Reddit
Flask Dashboard - Open-Source Boilerplates
https://dev.to/sm0ke/flask-dashboard-open-source-boilerplates-dkg
/r/flask
https://redd.it/caji9n
https://dev.to/sm0ke/flask-dashboard-open-source-boilerplates-dkg
/r/flask
https://redd.it/caji9n
DEV Community
Flask Dashboard - Open-Source Boilerplates
Open-Source Flask dashboards released under the MIT license.
Jupyter Notebook Doesn't Show Files When It Loads
I start up Jupyter Notebook using the Anaconda prompt, it loads, and there are no files shown. I also can't create new files through Jupyter. I've reinstalled the program, restarted my computer, reinstalled Anaconda; nothing is working. Please help.
/r/JupyterNotebooks
https://redd.it/cb4qde
I start up Jupyter Notebook using the Anaconda prompt, it loads, and there are no files shown. I also can't create new files through Jupyter. I've reinstalled the program, restarted my computer, reinstalled Anaconda; nothing is working. Please help.
/r/JupyterNotebooks
https://redd.it/cb4qde
reddit
r/JupyterNotebooks - Jupyter Notebook Doesn't Show Files When It Loads
1 vote and 1 comment so far on Reddit
allowed_hosts behind load balancer
What value can I set allowed_hosts to if my server(s) are behind a reverse proxy or load balancer? In particular, this is an Elastic Load Balancer, so the front-end IPs are dynamic.
I have * as the current setting.
/r/django
https://redd.it/cb6tcq
What value can I set allowed_hosts to if my server(s) are behind a reverse proxy or load balancer? In particular, this is an Elastic Load Balancer, so the front-end IPs are dynamic.
I have * as the current setting.
/r/django
https://redd.it/cb6tcq
reddit
r/django - allowed_hosts behind load balancer
2 votes and 2 comments so far on Reddit
CAN NOT serve website with Apache2
I have been stuck on this for over a week now. Nothing I do fixes this problem.
​
Basically, on my digital Ocean VPS I have my Django project. When I run the command "python3 [manage.py](https://manage.py) runserver [0.0.0.0:8000](https://0.0.0.0:8000)" it perfectly works. I can open my vps IP address at the port :8000 and it loads just fine.
However, when I try to serve it using Apache and I go on the IP address, I just get a page that says "Server Error (500)".
My config file looks [The same as this](https://github.com/CoreyMSchafer/code_snippets/blob/master/Django_Blog/snippets/django_project.conf) except filled in with the correct file paths.
​
I have set the permissions using chmod and :www-data according to like 5 different tutorials, none have changed anything. What do I do?
/r/django
https://redd.it/cbbhb2
I have been stuck on this for over a week now. Nothing I do fixes this problem.
​
Basically, on my digital Ocean VPS I have my Django project. When I run the command "python3 [manage.py](https://manage.py) runserver [0.0.0.0:8000](https://0.0.0.0:8000)" it perfectly works. I can open my vps IP address at the port :8000 and it loads just fine.
However, when I try to serve it using Apache and I go on the IP address, I just get a page that says "Server Error (500)".
My config file looks [The same as this](https://github.com/CoreyMSchafer/code_snippets/blob/master/Django_Blog/snippets/django_project.conf) except filled in with the correct file paths.
​
I have set the permissions using chmod and :www-data according to like 5 different tutorials, none have changed anything. What do I do?
/r/django
https://redd.it/cbbhb2
Django models
What is the use of models if I am not storing any data in the database? I am purely getting data from the database to display on the template.
/r/django
https://redd.it/cbbdhc
What is the use of models if I am not storing any data in the database? I am purely getting data from the database to display on the template.
/r/django
https://redd.it/cbbdhc
reddit
r/django - Django models
1 vote and 3 comments so far on Reddit
Flask Restful API
Hey,
I want to master creating APIs in flask for big applications using flask Restful and blueprints which documentation should i follow to be a pro in this.
Any suggestion will be appreciated.
/r/flask
https://redd.it/cbdu5m
Hey,
I want to master creating APIs in flask for big applications using flask Restful and blueprints which documentation should i follow to be a pro in this.
Any suggestion will be appreciated.
/r/flask
https://redd.it/cbdu5m
reddit
r/flask - Flask Restful API
0 votes and 0 comments so far on Reddit
Can anybody pls pls pls help me
I have this statement to fetch data from database posts=Posts.query.filter_by().all(). So, my question is posts is class and query is attribute and after query there is function filter_by so why we put attribute before query I want to know how it's work. And one more thing after function filter_by()another function .all(). So,how these function and attribute works from under the hood
/r/flask
https://redd.it/cbc1c1
I have this statement to fetch data from database posts=Posts.query.filter_by().all(). So, my question is posts is class and query is attribute and after query there is function filter_by so why we put attribute before query I want to know how it's work. And one more thing after function filter_by()another function .all(). So,how these function and attribute works from under the hood
/r/flask
https://redd.it/cbc1c1
reddit
r/flask - Can anybody pls pls pls help me
0 votes and 2 comments so far on Reddit
Video | List Files in a Directory | 1:44
https://www.youtube.com/watch?v=EbHgUA4Sgq4
/r/Python
https://redd.it/cbf28o
https://www.youtube.com/watch?v=EbHgUA4Sgq4
/r/Python
https://redd.it/cbf28o
YouTube
Python | List Files in a Directory
In this video we look into how to list the files and the directory of current path or a specific path using the os library and the glob library. The os library's list dir allows for easy and simple listing of directory of current and specific path, while…