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
Wednesday Daily Thread: Beginner questions

New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/v23qzz
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!

This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.

/r/Python
https://redd.it/v2vgf8
Making a Custom Graph in Jupyter Noteboook

I'm interested in plotting nontraditional logic,math, and networking graphs that don't fall on xy planes or maps. Does anyone know good tutorials for making these nontraditional graphs in Jupyter notebook I would also like them to be interactive?

/r/JupyterNotebooks
https://redd.it/v3h6or
How to connect SQL Server to Jupyter

Hello guys! Does anyone know how's the best way to connect to SQL Server through Jupyter Notebooks?

​

Thanks in advance

/r/JupyterNotebooks
https://redd.it/v780gr
Old android phone as flask test server

I know this isn't anything new, but I hadn't considered this before so thought I'd share. Flask apps are pretty lightweight so I pulled out an old Pixel 3 XL I had laying around and repurposed it into a flask dev server in no time and doesn't require rooting (unless you want docker). Shouldn't harm anything, but usual disclaimer if you try this on your primary phone.

1. Factory reset phone for good starting base (Optional, recommended if you aren't using it)
1. Also connect to wifi
2. Install termux (from f-droid, not the app store)
1. Download apk: f-droid.org/repo/com.termux_118.apk
2. Allow install from external sources and install
3. Launch termux
3. Set password and update environment
1. passwd
2. pkg update && pkg upgrade
4. Install and run ssh server (dropbear for convenience)
1. pkg install dropbear
2. dropbear
5. Termine IP address and test ssh (should be able to access)
1. ifconfig|grep inet
6. Install python
1. pkg install python
7. Create your flask application, scp it over if needed, and run in termux
1. flask run -h 0.0.0.0 -p 5000
8. You should

/r/flask
https://redd.it/vlz6kt
Sunday Daily Thread: 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/vq4m4j
Wednesday Daily Thread: Beginner questions

New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/vsc2cv
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!

This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.

/r/Python
https://redd.it/vt4i5k
Just finished up a big release for a little side project. I rarely see real-world examples of Flask projects on this sub, so I figured I'd share what I built. It's fairly simple, but happy to answer questions.
http://www.fantasynamesearch.com

/r/flask
https://redd.it/vud22s
Jupyter Notebook Competition deadline coming up!

The Jupyter Notebook Competition deadline is fast approaching!

https://preview.redd.it/7zh3i14eyx991.png?width=1920&format=png&auto=webp&s=954265fdc4daad581167051f72f4f17eb33d94bf

Don't miss out on your chance to contribute to a community-driven resource of notebooks on the Copernicus WEkEO platform, AND be in with a chance of winning cash prizes!

Visit: https://www.eumetsat.int/features/new-jupyter-notebook-competition

/r/JupyterNotebooks
https://redd.it/vsotwi
Deploy react inside django as a django app on Heroku

I have worked with deploying django and react separately as separate heroku apps and integrate them. But I don't know how to deploy a structure where the reactapp is inside Django's project directory disguised as a django app. How do you run the npm build on Heroku? I couldn't find any tutorials that does this, can someone help me out here? thanks!

/r/django
https://redd.it/w12hk0
nbsnapshot - Automated Jupyter Notebook Testing

​

https://preview.redd.it/hfag3h6fyl991.png?width=1201&format=png&auto=webp&s=ce07fd38ec64cdd33578d2157a7c955a82ce4b42

Hi all!

I want to share a project I've been working on to facilitate Jupyter notebook testing!

When analyzing data in a Jupyter notebook, I unconsciously memorize "rules of thumb" to determine if my results are correct. For example, I might print some summary statistics and become skeptical of some outputs if they deviate too much from what I've seen historically. For more complex analysis, I often create diagnostic plots (e.g., a histogram) and check them whenever new data arrives.

Since I constantly repeat the same process, I figured I'd code a small library to streamline this process. nbsnapshot benchmarks cell's outputs with historical results and raises an error if the output deviates from an expected range (by default, 3 standard deviations from the mean). You can see an example in the image accompanying this post.

To learn more, check out the blog post.

I'd love to hear what you think!

/r/IPython
https://redd.it/vrg1yv
Incoporating lens(df) value into groupby() function

Task 5b: Calculate percentage of people with work experience that are offered a job, the percentage of people with work experience not offered a job, the people with no work experience offered a job and the percentage of people with no work experience not offered a job.

len(df.index)
print(df.index)

output

RangeIndex(start=0, stop=120, step=1)

Tried to put the value of 120 into groupby but failed

​

dfworkexp = (df.groupby('index')['status']
.value
counts(normalize=True)
.resetindex(name='perc'))
print (df
workexp)

/r/IPython
https://redd.it/w3isc0
Publishing charts on the web with Panel - is HvPlot relevant?

I switched a while back from Matplotlib and Seaborg to Plotly - since it's interactive and just IMHO looks better. I've been looking to implement some of my figures on my website. There is a simple way to simply export to HTML from Jupyter, but I see two limitations with this:

1) The code is very long, and sometimes crashes my browser when just pasting the code for a single figure

2) As I understand it there are limitations to the interactivity with this approach.

Due to this, I've been looking into Panel and HvPlot. There are so many modules mentioned around the docs though that I can hardly see what is relevant to my use case. It seems Plotly can be implemented directly in Panel so I'm not sure if HvPlot should be used as a medium between Plotly and Panel to enable more functions or rather as an alternative to Plotly.

If anyone has experience setting up widgets and similar, I'd be very interested in some tips here!

/r/IPython
https://redd.it/vri0lz
Sunday Daily Thread: 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/wcb3af
Plotting 3D vectors with autosized coordinate axis

I often need to visualize 3D vectors for statics problems in Jupyter Lab for which i currently use the following code using matplotlib quiver. I currently normalize the vectors to keep them within the area, but that's a huge limitation.

I'd like to have the colored coordinate axis (x,y,z) shown all the time, and have the axis scale with the plot area automatically, depending on the position and size of the plotted vectors. The plot would show the actual magnitude and direction of the vector. Can anyone help me out?

The following code produces the plot:
[Plot](https://i.stack.imgur.com/1kz8n.png)

import matplotlib.pyplot as plt
%matplotlib ipympl

# vector data. not important
roa_vek=Matrix([0,0,12])
rob_vek=Matrix([4,12,0])
rab_vek=rob_vek-roa_vek
f=2000
fab_vek=f*rab_vek/rab_vek.norm()
mo=roa_vek.cross(fab_vek)

ax=plt.figure().add_subplot(projection='3d')

# if i dont set these, the plot is all zoomed in
ax.set_xlim([-1,1])
ax.set_ylim([-1,1])
ax.set_zlim([-1,1])

ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.set_zlabel("Z")
origo=[0,0,0]
ax.view_init(30, 45)

# Coordinate system

/r/IPython
https://redd.it/wfums8
Sunday Daily Thread: 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/wi1x0f