FLOSS Project Planets

KDE Applications 19.08 branches created

Planet KDE - Mon, 2019-07-15 15:22

Make sure you commit anything you want to end up in the KDE Applications 19.08 release to them

We're already past the dependency freeze.

The Freeze and Beta is this Thursday 18 of July.

More interesting dates
August 1, 2019: KDE Applications 19.08 RC (19.07.90) Tagging and Release
August 8, 2019: KDE Applications 19.08 Tagging
August 15, 2019: KDE Applications 19.08 Release


Categories: FLOSS Project Planets

PSF GSoC students blogs: Weekly check-in #4

Planet Python - Mon, 2019-07-15 15:10

Hello there! Good to see u here.

Now, I'll tell what you are here for!

What did you do this week?

So, I finished the implementation last week and its already merged. This week I completed mockup for the cheatsheet(that's what we are calling that). Its a subpage of main EOS icons landing page which contains all the icons. Its has two subsections itself one is for EOS icons and second one is for extended EOS icons that are made 1-1 from google material icons. Currently mentors are reviewing that mockup and I am modifying the changes accordingly.

What's coming next?

After this is over I'll start the implementation of the cheatsheet. First I will create everything in basic HTML, CSS and bootstrap 4 they I'll have to convert it to pug and SCSS according to our new SMACSS structure that my mentors introduced recently.

Did you stuck anywhere?

Not really but, yes I was stuck a bit when I was testing the converting HTML into pug. But my mentors helped me out of it.

So, ya that's it for now. See you next week!

Categories: FLOSS Project Planets

PSF GSoC students blogs: Week 7: Weekly Check-In (#4)

Planet Python - Mon, 2019-07-15 14:52

1. What did you do this week?

This week i finally got my first case of equivalence between the new SourceTFR API and the old source_induced_power function. As it turned out, the unequal results were not actually a problem of the code, but instead resulted from a tiny bug in the source_induced_power function, which i use to test my project. It resulted from a parameter not properly passed, which caused different wavelet functions to return different time_frequency transforms...

2. What is coming up next?

Now, the first thing i'll do is to introduce fully parametrized tests to make sure that the wavelet function works for all cases of SourceEstimates and all cases of parameters. If i get this through fast, i might even start to do the same thing for multitapers.

3. Did you get stuck anywhere?

Yeah, well: If you have to analyze and compare each line between two different (and heavily nested) functions, until you notice that a rather unrelated part is causing the actual problem, i wouldn't exactly call that 'getting stuck'. Anyhow, it results in the same time loss ;)

Categories: FLOSS Project Planets

TechBeamers Python: Python String Find()

Planet Python - Mon, 2019-07-15 13:32

This tutorial explains Python string find() method that searches a substring and returns the index of its first occurrence. If not successful, then it returns the status as (-1). Let’s try to understand its usage with the help of simple examples. 1. Find() syntax 2. Find() with default values 3. Find() with multiple occurrences of substrings 4. Find() when no substrings exist 5. Find() with start and end indices Let’s now go through each of the section one by one. Python String Find() with Examples String’s find() is a built-in Python function that finds a substring into another string which

The post Python String Find() appeared first on Learn Programming and Software Testing.

Categories: FLOSS Project Planets

PSF GSoC students blogs: Weekly Check-in #6

Planet Python - Mon, 2019-07-15 13:22

Hi everyone!

Time for another update. These past two weeks I've been trying to clean up how I've been implementing things, since a lot of my code thus far has been pretty prototypey. I have the backend at a point where I can start to turn to other features, like multitouch. This past week I implemented some basic mouse emulation, which you can take a look at here:

See you next week!

Categories: FLOSS Project Planets

Mediacurrent: [Webinar Registration] We Built This City On Drupal 8

Planet Drupal - Mon, 2019-07-15 11:30

How did the City of Sandy Springs, GA improve information system efficiency with a unified platform? Join our webinar to see how we built this city on decoupled Drupal 8, GatsbyJS, and Netlify.

We'll explore how a “build-your-own” software approach gives Sandy Springs the formula for faster site speed and the ability to publish messages across multiple content channels — including new digital signage.

What You'll Learn
  • The City of Sandy Springs’ challenges and goals before adopting Drupal 8 

  • How Sandy Springs manages multi channel publishing across the website, social media, and a network of digital signage devices. 

  • Benefits gained from Drupal 8 and GatsbyJS, including: a fast, reliable site, hosting costs, and ease of development for their team.  

Jason Green, Visual Communications Manager at City of Sandy Springs, and Mediacurrent Director of Front End Development Zack Hawkins share an inside look at the project.


Follow the City of Sandy Springs on the path to government digital innovation.  Save your seat today!

Categories: FLOSS Project Planets

PyCharm: PyCharm 2019.2 Beta #2

Planet Python - Mon, 2019-07-15 11:26

It hasn’t been long since we published PyCharm 2019.2 Beta, and now we’re ready to share with you the second Beta build! The final release date is getting closer and closer, and while you wait, give PyCharm 2019.2 Beta #2 a go! Get the PyCharm 2019.2 Beta build from our website and try all the latest functionality.

New in PyCharm 2019.2 Beta #2 Share your Jupyter Notebooks in Datalore

You may have heard of JetBrains Datalore, an intelligent web application for data analysis. You can perform data analysis directly in it and enjoy the intelligent code editor, user-controlled code execution and real-time collaboration features. Alternatively, you can work with your Jupyter notebooks in PyCharm and give your teammates real-time access to your notebooks through the bundled Datalore plugin.

Learn more in PyCharm documentation.

Further Improvements

For more details on what’s new in this version, please refer to the release notes.


Get the PyCharm 2019.2 Beta #2 build from our website. Alternatively, you can use the JetBrains Toolbox App to stay up to date with early builds.
This build is part of Early Access Programm, so the EAP rules apply.

EAP Program Key Facts
  • The EAP version of PyCharm Professional Version is free to use
  • EAP build will expire after 30 days
  • This is pre-release software, you may face stability issues and other rough edges
  • You can install the EAP version alongside a stable version of PyCharm
  • EAP versions of PyCharm report statistics by default, you can opt out by changing the settings in Preferences | Appearance & Behavior | System Settings | Data Sharing
  • The latest version of the documentation is now also available
Categories: FLOSS Project Planets

Codementor: Python Celery Guide

Planet Python - Mon, 2019-07-15 11:23
Everyone in the Python community has heard about Celery at least once, and maybe even already worked with it. Basically, it’s a handy tool that helps run postponed or dedicated code in a separate...
Categories: FLOSS Project Planets

Codementor: Serving Gifs With Discord Bot - Reading Time: 12 Mins

Planet Python - Mon, 2019-07-15 10:31
Building a Discord Chatbot with Giphy API
Categories: FLOSS Project Planets

PSF GSoC students blogs: Week #7

Planet Python - Mon, 2019-07-15 10:28

I managed to reduce the performance time to ~100 sec from 26 minutes by fetching a bigger chunk of data at a time than was fetched before. Furthermore, I successfully implemented hyperbox for loading matrix, which essentially is a method of subsampling from loading matrix so that the data is well-represented with less sample. Although more loss was induced by this, I'm inclined to conclude that the cost is manageable and the benefit in terms of speeding up the performance outweighs the cost. In fact, since I'm applying approximation PCA method, some degree of loss for this PCA is expected.

What did I do this week?

Improved overall PCA performance

Did I get stuck anywhere?

I was getting errors because I miscalculated the dimension needed for reconstruction

What will I work on next week?

Seems like PCA has almost come to an end (?). Once I clean up the code, produce some example notebooks for reference, with mentor's approval, I will probably begin working on non-negative matrix factorization, if not this week, next week.

Categories: FLOSS Project Planets

PSF GSoC students blogs: Optimizing "map" and "zip" - Weekly check in #4

Planet Python - Mon, 2019-07-15 10:08
1. What did you do this week?

This week I started up with optimizing "map" built-in but later realised that I first need to optimize "zip" as there is no support on Nuitka for it as "map" is dependent on it. Initially I implemented the C backend for Python2 "zip" function but after discussing with my mentor we decided to keep only C backend for Python3 "zip" and depend on re-formulation for Python2 "zip" built-in.

2. What is coming up next?

Next up I will optimize zip for Python 3 and then get back to optimize "map" built-in.

3. Did you get stuck anywhere?

Well, I wouldn't say I was stuck anywhere but I had a lot of discussions on developing an optimization approach for the built-in mentioned above. 




Categories: FLOSS Project Planets

Real Python: Real Python at PyCon US 2019

Planet Python - Mon, 2019-07-15 10:00

There are many PyCons all over the world each year, but the biggest of them all is PyCon US (United States). This year, over 3000 Pythonistas descended on Cleveland, Ohio, to learn, collaborate, contribute, and meet old and new friends alike. I’m sure many of you are already aware of what PyCon US is, but if not, then I would suggest reading our guide to PyCon to learn more.

Our First PyCon Together

This year, Real Python was afforded the opportunity to join other content creators at the PyCharm Content Creators booth, where we got to spend some time meeting readers and members of the Real Python community. Oh, and we gave out a ton of Real Python stickers, and we ran out of stock completely! Did you get yours?

The team was also excited for our authors Geir Arne Hjelle and Anthony Shaw, who were also there as speakers. You can catch the recordings of their talks on Plugins: Adding Flexibility to Your Apps and Wily Python: Writing simpler and more maintainable Python on the PyCon YouTube channel.

We were also lucky enough to be able to arrange a Real Python open space at PyCon for our readers. We had a phenomenal turnout, with 30 people in attendance.

It was a great opportunity for us to not only get to shake your hands and thank you for helping us with your encouragement and feedback but also to make sure we can continue to push and produce better and better content. Listening to the feedback from those who attended was an amazing experience, and we will be taking some of the ideas generated going forward to help us deliver a better reading and learning experience to you.

Despite the daily conversation in the member and staff Slack groups, most of the Real Python team had never met each other in person. Meeting my colleagues face to face and sharing a meal or beer with them was definitely one of the highlights of the whole conference for me personally.

But I decided to ask the rest of the team about their experience, in hopes that we could come up with some helpful advice or actionable tips for you in case you have yet to attend your first PyCon.

I asked the same three questions to a few of the team members who attended PyCon and collated their answers below. The questions were:

  1. Can you briefly tell us who you are and what you do, in and out of Real Python? Was this your first PyCon? If so, what made 2019 the year you decided to go for the first time?
  2. What were the highlights of your PyCon? What memories will you have of PyCon 2019?
  3. There is so much to do at PyCon that it’s impossible to do everything. What was something you didn’t get the chance to do but wish you had?

Team Interviews

Without further ado, let’s see what they had to say.

Jim Anderson

I’m Jim Anderson, and I’m an embedded firmware developer by day, mainly working in C++ to produce video security cameras. I get to do a bit of Python at work as well. At Real Python, I’m an author and a technical reviewer, generally tending towards articles that are either low-level, tool related, or general CS topics.

This was my first PyCon. I finally decided to go just due to the excitement I was seeing about it in the Real Python community. Folks that I knew who had been previously talked it up so much. They were right.

There were so many highlights! Getting to finally meet some of my Real Python co-workers was very cool, of course, as was hanging out in the content-creators section of the PyCharm booth. (Thanks, JetBrains!)

I’d say that the best memory I have, the one that really solidified the atmosphere in my mind, was seeing a friend from PythonistaCafe and PyCon talking with someone who was working the venue cleaning up. She was so taken by the friendliness of the conference that she was asking about it and figuring out how she could be a part of it next year. Maybe we’ll get to see her in Pittsburgh.

There was a talk that I had scheduled to go to and just blew the timing and missed. It was Building an Open Source Artificial Pancreas, and I’m still disappointed I didn’t make it. It’s a great topic and a great talk.

Geir Arne Hjelle

My name is Geir Arne Hjelle, and I grew up in a small village in the north of Norway. Currently, I live in Oslo where I work with different data science and machine learning projects. Most of the time, I get to use Python and the excellent data science stack built on top of numpy.

I have been writing for Real Python since the spring of 2018, mostly about general Python packages and concepts. My first article was about the pathlib package, and I’m currently working on one about how imports work. In addition, I support other authors by doing reviews of their articles, both outline reviews and technical reviews.

This year was my first PyCon US. I live in Norway, so I mainly attend conferences in Europe. This fall, I will be at EuroSciPy for the fifth time. However, after joining the Real Python team, I was really tempted by the opportunity to meet some of my new friends and colleagues out in the wild.

James and I managed to meet up last summer, but otherwise I mainly knew the team by their Slack avatars. Meeting and hanging out with the rest of the Real Python gang, and nerding out over some of the reviews we’ve done for each other are great memories I’ll treasure for a long time.

There is so much happening at PyCon. I went all in and stayed for the tutorials, the main conference, and parts of the sprints. I really enjoyed all of it.

The tutorials were great, including David Beazley’s deep dive into lambda calculus. (Yay, math!) I was lucky enough to get to give a talk during the conference, which was a lot of fun. I was very well taken care of before my presentation: I think this is the first time I’ve had my own room for preparations, and someone walking me over to the presentation room.

Afterwards, I got some very nice and interesting questions. During the sprints, I got to help out a little on the new importlib.metadata library Jason Coombs and Barry Warsaw are putting together for Python 3.8. It was great to see first-hand how some of the core developers are working.

I had so many great experiences in Cleveland that it’s hard to think of things I didn’t have a chance to do. Although, I’ll admit that at this PyCon, I was quite focused on myself (especially with my talk being during the last session of the conference).

Next time, I’ll set aside some time for volunteering and make sure to support the running of the conference more than I did this time around. It was great to see how everybody chipped in: I was welcomed and checked in by Ernest W. Durbin III, who was also the chair of the whole conference.

James Mertz

I’m James Mertz, and I’m a Software Assurance Engineer at NASA’s Jet Propulsion Laboratory (JPL). I’m currently working on the Europa Clipper project, which is a satellite that will be orbiting around Jupiter and making very close trips near the moon Europa. I’ve been writing for Real Python for about a year now with topics ranging from documenting Python to how to get the most out of PyCon.

This is my fourth year at PyCon, so I’m starting to get to know my way around the conference, although each year it’s different enough to keep bringing me back. This year was by far the best for me for two reasons: volunteering and meeting up with the Real Python gang (both the authors and the readers).

In my guide on How to Get the Most Out of PyCon, I really put a focus on volunteering at PyCon. I realized that, while I had done some things in years past, I hadn’t really practiced what I was preaching. I decided to fully embrace this and tried to help in every way I could.

By the end of the conference, I had:

  • Been a tutorial “bouncer” for David Beazley’s deep dive into lambda Calculus
  • Helped with registration check-in and even got to check in Michael Kennedy from Python Bytes and Talk Python to Me
  • Done the swag bag stuffing line dance DJ-ed by Larry Hastings
  • Been a session staff runner (the person who makes sure the speaker is in the room on time)
  • Been a session staff chair (the person who introduces the speaker)

Through it all, I made some really amazing connections and felt great being able to contribute a little to the community that I love so much.

Speaking of community, meeting up with the Real Python community was another big highlight. As authors, we really don’t get many chances to meet with each other face to face. Therefore, to finally meet up with some of the people that I’ve come to know so well digitally, in the physical world, was a surreal experience. What made it better was that, even though we were all from different places in the world with different life experiences, we were able to quickly build a team spirit.

Perhaps even better than meeting my other Real Python team members, was meeting you, the readers. We held our first Real Python open space, where many of you stopped by to chat. As an author for a digital publisher, it’s hard sometimes to connect with the people that you’re writing for, but for me, that has become easier.

This year’s PyCon experience was overall fairly balanced as I got to do a lot of networking, seeing talks and tutorials, and even volunteering. The only thing that I could think that I wish I could’ve done was to give a presentation of some sort. That’s what next year is for though.

Dan Bader

Hey I’m Dan Bader, and I’m the owner and editor-in-chief here at Real Python. I also do all of the back-end and front-end development for the Django-based CMS and other infrastructure that realpython.com runs on.

I’m a long-time Pythonista and super passionate about teaching Python. Publishing my own Python programming book was a lifelong dream and getting to run Real Python together with an awesome team now is the icing on the cake!

This year was my fifth PyCon, and it won’t be the last, that’s for sure…

My personal highlights were hanging out with the Real Python tutorial team and meeting many of them in person for the first time. That just made my heart jump! We went out for food and drinks a couple of nights, and one random memory that I’ll probably never forget is finding out how much Logan loves the Golden Girls TV show : - D

During the day, the nice folks at JetBrains gave us some space at their PyCharm booth, so we all got to wear our Real Python swag and chat with readers as well as hand out stickers and pins. That was super fun!

Another great memory is the Real Python open space we organized where several dozen readers and members showed up to say “hi.” That just blew my mind and was one of my favorite PyCon experiences so far!

I felt pretty burned out when I first arrived at PyCon after working non-stop for a couple of months on the launch of our video subscriptions feature, and seeing this massive turnout felt amazing. I didn’t really know what to say at first! Thanks everybody for stopping by :)

This year was also the second time we hosted an open-space meetup for the PythonistaCafe forum, and it was super cool to see how this wacky little project has sparked such a tightly knit and awesome community now.

Another highlight was recording a live episode of the Talk Python podcast together with Mike Kennedy. Always a treat hanging out with this guy :)

I wish I would’ve had more time to go to talks. I was super impressed with the talks that Geir Arne and Anthony from the Real Python Tutorial Team gave. Be sure to check out the recordings when you have the chance.

Happy Pythoning, and see you next year!


Regardless of the location, a PyCon is a joyous experience. Whether you are meeting colleagues, online friends, or strangers who share a passion other than Python, it’s the people that make the experience special. The old saying, “came for the language, but stayed for the community” never rings more true than at PyCon US.

No two Pythonistas are the same, and there is something for everyone in the diversity of the events, talks, and tutorials taking place. Personally, I’m looking forward to next year’s PyCon already. Schedule permitting, I’ll make every effort to join the sprints in 2020. But even if I don’t get to tick that off my list, I already know that next year I’ll be excited to meet you and many others in spite of my introversion.

If you were at PyCon US and came to say “hi,” or joined us for the Real Python or PythonistaCafe open spaces, then leave a comment below and let us know what your favorite part of PyCon was. What’s your one tip you would give someone who will be attending any PyCon for the first time next year? Happy coding!

[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]

Categories: FLOSS Project Planets

Codementor: Python Snippet 1: More Uses For Else

Planet Python - Mon, 2019-07-15 09:31
Get familiar with the different uses for else in Python. It's not just for if statements: we can use it with loops, and for error handling too!
Categories: FLOSS Project Planets

PSF GSoC students blogs: For fork's sake - Fixing multiprocessing issues

Planet Python - Mon, 2019-07-15 08:42
What did you do this week?

It was also reported that scipy.fft does not interact well with python's multiprocessing library. I was able to track down the issue and resolve it within a few hours, adding a unit test to ensure this wouldn't be broken again. However, when I went to update my uarray PR to use the new fast C++ version, the test started to fail. It turns out, the uarray multimethod objects needed to be pickleable in a very specific way that mimicks the behaviour of python Function types. Thankfully, after applying this fix the issue was resolved.

I've also this week:

  • added Hermitian symmetric transforms to scipy.fft (merged in scipy#10425)
  • added scipy.fft to the 1.14.0 release notes
  • updated my PR adding uarray support to scipy.fft
  • started work on adding a `scipy.fft` compatible interface to pyfftw in pyFFTW#269. This will be one of the first useful backend implementations for the new backend system.
What is coming up next?

The backend system PR is set to be merged very soon so I should be able to focus on adding the uarray protocol to pyfftw and possibly contributing compatible backends to other FFT libraries.

I can also work on pre-planned transforms.

Did you get stuck anywhere?

The multiprocessing incompatibilities posed an unexpected challange but I was able to work though the problems alright.


Categories: FLOSS Project Planets

Catalin George Festila: Python 3.7.3 : Programming Krita.

Planet Python - Mon, 2019-07-15 07:21
Today I wrote a python tutorial about Krita software and programming python. The Krita software use python version 3.6.2. ==== Warning: Script not saved! ==== 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] The full tutorial can be found at my Blogspot (a Blogspot about the graphics area).
Categories: FLOSS Project Planets

Erik Marsja: 9 Data Visualization Techniques You Should Learn in Python

Planet Python - Mon, 2019-07-15 06:31

With ever increasing volume of data, it is impossible to tell stories without visualizations. Data visualization is an art of how to turn numbers into useful knowledge. Using Python we can learn how to create data visualizations and present data in Python using the Seaborn package.

In this post we are going to learn how to use the following 9 plots:

  1. Scatter Plot
  2. Histogram
  3. Bar Plot
  4. Time Series Plot
  5. Box Plot
  6. Heat Map
  7. Correlogram
  8. Violin Plot
  9. Raincloud Plot
Python Data Visualization Tutorial: Seaborn

As previously mentioned in this Python Data Visualization tutorial we are mainly going to use Seaborn but also Pandas,  and Numpy. However, to create the Raincloud Plot we are going to have to use the Python package pititprince.

Python Raincloud Plot using the ptitprince package

Installing Seaborn

Before we continue with this Python plotting tutorial we are going to deal with how to install the needed libraries. One of the most convenient methods to install Seaborn, and it’s dependencies, is to install the Python distribution Anaconda. This will give you many useful Python libraries for doing data science (e.g., Numpy, SciPy, Matplotlib, Seaborn).

How to Install Seaborn using Pip

pip install seaborn

How to Install ptitprince

In the last Python data visualization example we are going to use a Python package called ptitprince. This package can be installed using Pip (as this post is written, it’s not available to install using Anacondas package manager conda):

pip install ptitprince

Scatter Plot in Python using Seaborn

Scatter plots are similar to line graphs. That is we use the horizontal and vertical axes to visualize data points. However, the aim is different; Scatter plots can reveal how much one variable is affected by another (e.g., correlation).

Scatter plots usually consist of a large body of data. The closer the data points come when plotted to making a straight line, the higher the correlation between the two variables, or the stronger the relationship.

In the first Python data visualization example we are going to create a simple scatter plot. As previously mentioned we are going to use Seaborn to create the scatter plot.

Note, it should be possible to run each code chunk by it’s own. Note, however, that some code lines are optional. For instance, %matplotlib inline is used to display the plots within the Jupyter Notebook and plt (imported from matplotlib.pyplot) is used to change the size of the figures.

Python Scatter Plot Example:

%matplotlib inline import matplotlib.pyplot as plt import pandas as pd import seaborn as sns # Suppress warnings import warnings warnings.filterwarnings('ignore') # Optional but changes the figure size fig = plt.figure(figsize=(12, 8)) df = pd.read_csv('https://vincentarelbundock.github.io/Rdatasets/csv/datasets/mtcars.csv') ax = sns.regplot(x="wt", y="mpg", data=df)

In all examples in this Python data visualization tutorial we use Pandas to read data from CSV files. More on working with Pandas and CSV files can be found in the blog post “Pandas Read CSV Tutorial“.

Changing the Labels on a Seaborn Plot

In the next example we are going to learn how to configure the Seaborn plot a bit. First we are going to remove the confidence interval but we are also going to change the labels on the x-axis and y-axis.

import pandas as pd import seaborn as sns fig = plt.figure(figsize=(12, 8)) ax = sns.regplot(x="wt", y="mpg", ci=False, data=df) ax.set(xlabel='MPG', ylabel='WT')

For more about scatter plots:

Histogram in Python using Seaborn

A histogram is a data visualization technique that lets us discover, and show, the distribution (shape) of  continuous data. Furthermore, histograms enables the inspection of the data for its underlying distribution (e.g., normal distribution), outliers, skewness, and so on.

Python Histogram Example

In the next Python data visualization example we will create histograms. Histograms are fairly easy to create using Seaborn. In the first Seaborn histogram example we have turned set the parameter kde to false. This so that we only get the histogram.

import pandas as pd import seaborn as sns df = pd.read_csv('https://vincentarelbundock.github.io/Rdatasets/csv/datasets/airquality.csv') fig = plt.figure(figsize=(12, 8)) sns.distplot(df.Temp, kde=False)

Grouped Histogram in Seaborn

If we want to plot the distribution of two conditions on the same Seaborn plot (i.e., create a grouped histogram using Seaborn) we first has to subset the data. In the histogram example below we loop through each condition (i.e., the categories in the data we want to visualize).

In the loop we will subset the data and then we use Sebaorn distplot and create the histograms. Finally, we change the x- and y-axis labels using Seaborn set.

import pandas as pd import seaborn as sns df = pd.read_csv('https://raw.githubusercontent.com/marsja/jupyter/master/flanks.csv', index_col=0) fig = plt.figure(figsize=(12, 8)) for condition in df.TrialType.unique(): cond_data = df[(df.TrialType == condition)] ax = sns.distplot(cond_data.RT, kde=False) ax.set(xlabel='Response Time', ylabel='Frequency')

Bar Plots in Python using Seaborn

Bar plots (or “bar graphs”) are a type of data visualization that are used to display and compare the number, frequency or other measure (e.g. mean) for different discrete categories of data. This is probably one of the most common ways to visualize data. Of course, like many of the common plots, there are many ways to create bar plots in Python (e.g., with Pandas barplot method).

Bar plots also offer some flexibility. That is, there are several variations of the standard bar plot including horizontal bar plots, grouped or component plots, and stacked bar plots.

Seaborn Bar Plot Example

In this example we are starting by using Pandas groupby to group the data by “cyl” column. After we have done that we create a bar plot using Seaborn.

import pandas as pd import seaborn as sns df = pd.read_csv('https://vincentarelbundock.github.io/Rdatasets/csv/datasets/mtcars.csv', index_col=0) df_grpd = df.groupby("cyl").count().reset_index() fig = plt.figure(figsize=(12, 8)) sns.barplot(x="cyl", y="mpg", data=df_grpd)

More on how to work with Pandas groupby method:

Setting the Labels of a Seaborn Bar Plot

When displaying data in Python it, of course, makes sense to be as clear as possible. As you can see in the figure

In the next example we are going to change labels because the y-axis actually represents the count of cars in each cylinder category:

import pandas as pd import seaborn as sns df = pd.read_csv('https://vincentarelbundock.github.io/Rdatasets/csv/datasets/mtcars.csv', index_col=0) df_grpd = df.groupby("cyl").count().reset_index() fig = plt.figure(figsize=(12, 8)) ax = sns.barplot(x="cyl", y="mpg", data=df_grpd) ax.set(xlabel='Cylinders', ylabel='Number of Cars for Each Cylinder')

Note, there might be better ways to display your data than using bar plots. Some researchers have named bar plots “dynamite plots” or “barbar plots”. This because when visualizing the mean, you might miss the distribution of the data (e.g., see Weissgerber  et al., 2015).

Time Series Plots using Seaborn

A time series plot (also known as a time series graph or timeplot) are used to visualize values against time. In the Python Time Series Plot example, below, we are going to plot number of train trips each month.

import pandas as pd import seaborn as sns train_data = "https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-02-26/full_trains.csv" df = pd.read_csv(train_data) fig = plt.figure(figsize=(12, 8)) sns.lineplot(x="month", y="total_num_trips", ci=None, data=df)

Grouped Time Series Plots using Seaborn

It is further possible to visualize the value in different groups. In the next timplot example we are going to display the number of trips from the train stations in Paris. Here we use str.contains to select the rows in the dataframe containing a certain string (i.e., “Paris”). We use the parameter hue to get a separate line for each category in the data (i.e., departure station).

import pandas as pd import seaborn as sns df = pd.read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-02-26/full_trains.csv") fig = plt.figure(figsize=(12, 8)) sns.lineplot(x="month", y="total_num_trips", hue="departure_station", ci=None, data=df[df.departure_station.str.contains('PARIS')])

Box Plots in Python using Seaborn

In the next examples we are going to learn how to visualize data, in python, by creating box plots using Seaborn. A Box Plot is a data visualization technique that is a little better compared to bar plots, for instance. Box Plots will visualize the median, the minimum, the maximum, as well as the first and fourth quartile. Any potential outliers will also be appearent in the plot (see image below, for instance).

Python Box Plot Example:

import pandas as pd import seaborn as sns df = pd.read_csv('https://vincentarelbundock.github.io/Rdatasets/csv/datasets/mtcars.csv', index_col=0) fig = plt.figure(figsize=(12, 8)) sns.boxplot(x="vs", y='wt', data=df)

Heat Map in Python using Seaborn

A heat map (or heatmap) is a data visualization technique where the individual values contained in a matrix (or dataframe) are represented as color. In the Seaborn heat map example, below, we are going to select a few of the columns from the mtcars dataset to create a heat map plot.

import pandas as pd import seaborn as sns df = pd.read_csv('https://vincentarelbundock.github.io/Rdatasets/csv/datasets/mtcars.csv', index_col=0) fig = plt.figure(figsize=(12, 8)) ax = sns.heatmap(df[['mpg', 'disp', 'hp', 'drat', 'wt', 'qsec']])

Correlogram in Python

We continue with an Python data visualization example in which we are going to use the heatmap method to create a correlation plot. Note, a correlogram is a way to visualize the correlation matrix. Before we create the correlogram, using Seaborn, we use Pandas corr method to create a correlation matrix. We are then using numpy to remove to upper half of the correlation matrix.

import numpy as np import pandas as pd import seaborn as sns # Correlation matrix corr = df.corr() mask = np.zeros_like(corr, dtype=np.bool) mask[np.triu_indices_from(mask)] = True fig = plt.figure(figsize=(12, 8)) sns.heatmap(corr, mask=mask, vmax=.3, center=0, square=True, linewidths=.5, cbar_kws={"shrink": .5})

Violin Plots in Python using Seaborn

In the next Python data visualization example we are going to learn how to create a violin plot using Seaborn. A violin plot can be used to display the distribution of the data and its probability density. Furthermore, we get a visualization of the mean of the data (white dot in the center of the box plot, in the image below).

import pandas as pd import seaborn as sns df = pd.read_csv('https://vincentarelbundock.github.io/Rdatasets/csv/datasets/mtcars.csv', index_col=0) fig = plt.figure(figsize=(12, 8)) sns.violinplot(x="vs", y='wt', data=df)

Raincloud Plots in Python using ptitprince

Finally, we are going to learn how to create a “Raincloud Plot” in Python. As mentioned in the beginning of the post we need to install the package ptitprince to create this data visualization (pip install ptitprince).

Now you may wonder what a Raincloud Plot is? This is a very informative method to display your raw data (remember, bar plots may not be the best method). A Raincloud Plot combines the boxplot, violin plot, and the scatter plot.

Python Rainclod Plot Example:

import pandas as pd import ptitprince as pt df = pd.read_csv('https://vincentarelbundock.github.io/Rdatasets/csv/datasets/iris.csv') ax = pt.RainCloud(x = 'Species', y = 'Sepal.Length', data = df, width_viol = .8, width_box = .4, figsize = (12, 8), orient = 'h', move = .0)


In this Python data visualization tutorial we have learned how to create 9 different plots using Python Seaborn. More precisely we have used Python to create a scatter plot, histogram, bar plot, time series plot, box plot, heat map, correlogram, violin plot, and raincloud plot. All these data visualization techniques can be useful to explore and display your data before carrying on with the parametric data analysis. They are also very handy for visualizing data so that other researchers can get some information about different aspects of your data.

Leave a comment below if there are any data visualization methods that we need to cover in more detail. Here’s a link to a Jupyter notebook containing all the 9 examples covered in this post.


Allen M, Poggiali D, Whitaker K et al. Raincloud plots: a multi-platform tool for robust data visualization [version 1; peer review: 2 approved]. Wellcome Open Res 2019, 4:63. https://doi.org/10.12688/wellcomeopenres.15191.1)

Weissgerber TL, Milic NM, Winham SJ, Garovic VD (2015) Beyond Bar and Line Graphs: Time for a New Data Presentation Paradigm. PLOS Biology 13(4): e1002128. https://doi.org/10.1371/journal.pbio.1002128

The post 9 Data Visualization Techniques You Should Learn in Python appeared first on Erik Marsja.

Categories: FLOSS Project Planets

Codementor: Generators in Python | How to use Python Generators

Planet Python - Mon, 2019-07-15 03:18
Learn what are generators in Python along with the advantages. Also learn how to create and use them along with various use cases.
Categories: FLOSS Project Planets

PSF GSoC students blogs: Week #6 | Guillotina PubSub

Planet Python - Mon, 2019-07-15 01:49

Issue #553

A consumer of the API needs to be able to subscribe to changes to a specific content object in Guillotina.

This week:-

Repository:- guillotina_pubsub

Created a new Addon for Guillotina which subscribe to changes made to any object and publish on a websocket service.

IObjectModifiedEvent is the event triggered everytime any object is modified, using this event details of changed object are publish on a channel of redis pubsub.

@content-changes is a websocket service which subscribe to all the changes made on the channel of redis pubsub and send to client.

Next week:-

Adding test cases for this Addon and necessary refractor to push the code to a new repository of guillotinaweb  

Categories: FLOSS Project Planets

Mike Driscoll: PyDev of the Week: Meg Ray

Planet Python - Mon, 2019-07-15 01:05

This week we welcome Meg Ray (@teach_python) as our PyDev of the Week! Meg teaches programming to other teachers and has developed Python-related curriculum. Meg is also the author of Code This Game, a book which will be coming out in August 2019. Let’s take some time to get to know her better!

Can you tell us a little about yourself (hobbies, education, etc):

I started out as an actor. I studied theater and moved to New York City to start out my career. One of the jobs I did to stay afloat while I was starting out was teaching theater classes to kids. I taught theater programs for students with disabilities as well as homeless youth. This lead me to my career as a special education teacher. I really enjoyed teaching and mentoring young people, particularly young people who have had challenges in their lives.

Around this time in my life, I began to learn to program. I was having a lot of fun with it, and I also started to understand computer science education as an equity issue. I was hired at a school to teach a software engineering and game design class that was required for all 9th graders. I learned as I went. I re-designed the course to include Python in addition to block coding and to be more inclusive of students with learning differences.

Now I develop curriculum and train other educators to teach computer science. Through the Cornell Tech Teacher in Residence initiative, I have been providing in-classroom coaching and support to K-8 teachers. I’ve also been working on my first book! Code This Game! is an intro to Python and computer science through designing a game. It was really fun to have the opportunity to apply everything I’ve learned about teaching Python to kids in a creative way.

On a personal note, I’m a new mom. One of the priorities that I have now is building community. I DM for a D&D (with babies!) campaign, and have been thinking about other ways to make space for family and community in my life. One thing that I love about Python is the Python community. For me that means participating in my local meetup, collaborating with others to support Python eductors, and attending Pycon as a family.

Why did you start using Python?

My partner is a software engineer. He really wanted me to attend the NYC Python meetup with him in 2013. I was convinced it would be boring, but agreed to go one time. I wrote my first program that evening and had a great time! I started going with him every week and using the time to practice and learn. Then he convinced me to attend Pycon with him in 2014. I signed up for a tutorial with Software Carpentry while he participated in the sprints. The rest is history. He’s also learned a lot about education since then. It’s been amazing to have the opportunity to push each other’s thinking, have debates about how CS is taught, and work on projects together.

What other programming languages do you know and which is your favorite?

I know some Processing and JavaScript. Python will always be my favorite!

What projects are you working on now?

At Cornell Tech, I’m developing and piloting a program called Raspberry Pi – in – a – Box. We noticed that students at underserved public schools don’t have the same opportunities to participate in “physical computing” and digital making as their counterparts at private and independent schools. We wanted to find out if it’s possible to make the Raspberry Pi more accessible to middle schoolers. Some of the obstacles that we need to think about are teacher training, cost, hardware and networking set-up, curriculum, as well as fitting it into the school day.

I’m also preparing a methods course that I’ll be teaching at NYU this fall. It’s an Introduction to Computer Science Education. It’s a deep dive into teaching CS at the K12 level. It is unique in that it is open to anyone who wants to take it as a non-matriculated course, and it is designed for students with a CS/programming background who are interested in education and for in-service and pre-service educators who are interested in CS/programming.

Which Python libraries are your favorite (core or 3rd party)?

Definitely ppb, which is a new education focused game library, that I’m very excited about. I’m a bit biased because the maintainers, Piper Thunstrom and Jamie Bliss, are friends and colleagues of mine, and I will be contributing as an advisor. However, I am really excited about how easy this library makes game development in learning environments!

I also think that there’s a lot of potential for NLKT (Natural Language Toolkit) in education. I’ve found it really fun to play around with and hope to find ways to use it for ELA (English Language Arts) and Social Studies – CS integration projects.

How did you become a speaker at tech conferences?

I had already started presenting my work on making CS education more accessible in education spaces. I submitted my first talk to PyGotham (the New York City Python conference) with a colleague who is a technologist. We gave a 30 minute joint talk. If I could re-write and re-present the talk I would, but instead I’ve just iterated from there. Every time I submit a talk or prepare for a talk, I have that little voice in my head telling me that I’m not qualified enough, not interesting enough, not enough. But I label it as imposter syndrome and keep going.

Do you have any advice for other aspiring speakers?

Think about what you are passionate about and what you have to say. Then think about the audience and frame it in a way that is useful and interesting to them. Don’t wait for your doubts or insecurities to go away. Let them chatter away, while you share your knowledge with others.

If you want to build your skills, start small. Look for opportunities to speak at a meetup, to co-present, and to give lightning talks. Then move on to submitting talks to regional conferences and then national/global conferences. If a talk doesn’t go as well as you hoped, it doesn’t mean you’re a bad speaker. It means you’re still developing. Reflect and iterate on it. Each talk is a learning experience that makes you a better speaker next time.

Thanks for doing the interview, Meg!

The post PyDev of the Week: Meg Ray appeared first on The Mouse Vs. The Python.

Categories: FLOSS Project Planets