Found 10784 Articles for Python

Python script to open a Google Map location on clipboard?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

852 Views

We generally open the browser to search for a specific site/place on google maps. And if you need to do this task multiple times a day, it becomes very boring. Now you can automate this task where your browser will open automatically and the webpage will show you the google maps of your desired location.InstallationFor this purpose, I’m going to use the paperclip package. As this is not the standard package, we need to install it using pip.>pip install pyperclip Collecting pyperclip Downloading https://files.pythonhosted.org/packages/2d/0f/4eda562dffd085945d57c2d9a5da745cfb5228c02bc90f2c74bbac746243/pyperclip-1.7.0.tar.gz Building wheels for collected packages: pyperclip Building wheel for pyperclip (setup.py) ... done Stored in directory: ... Read More

Plotting Data on Google Map using pygmaps package?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

324 Views

Python pygmaps library provides a wrapper for the google maps javascript api. With this library python users can create a matplotlib like interface to generate the html and javascript and then can depicts all the additional information user’s would like to add on top of Google Maps.Required libraryWe are only going to use the pygmaps library/package. You can install the pygmaps library using pip, like:$pip install pygmaps (windows os) $sudo pip3 install pygmaps (linux os)We are going to write a program which will display -Create a map using pygmaps by providing long, lat & zoom level.Set grids on map by ... Read More

Phyllotaxis pattern in Python?

Nitya Raut
Updated on 30-Jul-2019 22:30:25

239 Views

What is phyllotaxis pattern?When we go back, in our botany classes and the plant world, phyllotaxis means the arrangement of flowers, leaves or seeds on a plant stem, similar to the one found in Fibonacci spiral. Based on Fibonacci sequence, the Fibonacci spiral is a set of numbers that follows a pattern similar on pascal’s triangle. The Fibonacci sequence numbers are something like - 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, etc. So the Fibonacci sequence number is the sum of its previous numbers.Fibonacci spiralsWe generally look for symmetry and patterns to understand the objects ... Read More

WebCam Motion Detector program in Python ?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

266 Views

In this we are going to write python program which is going to analyse the images taken from the webcam and try to detect the movement and store the time-interval of the webcam video in a csv file.Required LibraryWe are going to use the OpenCV & pandas library for that. If it’s not already installed, you can install it using pip, with something like:$pip install opencv2, pandasExample Code#Import required libraries import cv2 import pandas as pd import time from datetime import datetime #Initialise variables stillImage = None motionImage = [ None, None ] time = [] # Initializing ... Read More

Fetch top 10 starred repositories of user on GitHub using Python?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

72 Views

Git is the most popular version control system, where millions of developers manage their project or files (code). In this we will try to fetch top 10 most starred repositories within a month.As we are mainly scraping the GitHub repositories, we are going to use mainly the, Requests & BeautifulSoup library to fetch the repositories.We will store the result in a file & display it. It will show the result based on position (stars) with name & repos.Below is the code to implement it:import requests from bs4 import BeautifulSoup r = requests.get('https://github.com/trending/lua?since=monthly') bs = BeautifulSoup(r.text, 'lxml') lista_repo = bs.find_all('ol', class_='repo-list') ... Read More

Conway’s Game Of Life using Python?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

472 Views

A British mathematician in an around 1970 created his “Game of Life” – which are basically a set of rules depicting the chaotic yet patterned growth of a colony of biological organisms. The “Game of Life” is a two-dimensional grid consists of “living” and “dead” cells.Rules of Game of lifeOverpopulation: A cell dies(off) if its surrounded by more than three living cells.Static: A cell lives(on) if its surrounded by two or three living cells.Underpopulation: A cell dies(off) if its surrounded by fewer than two living cells.Reproduction: A cell becomes live(on) if a dead cell is surrounded by exactly three cells. Cell ... Read More

Run Python script from Node.js using child process spawn() method?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

1K+ Views

NodeJs and Python are two main preferred languages among developers and web designers. But there are couple of areas where NodeJs fall short of python are numerical and scientic computation (AI, Machine learning, deep learning etc.). Whereas python provides lots of libraries to work with scientific computing lot easier.Luckly, we can utilise the python libraries within our nodejs application by running python in the background and return back the result.For this we are going to use the child_process standard library of NodeJs to spawn a pyton process in the background, do computation and return back the result to our node ... Read More

Identifying handwritten digits using Logistic Regression in PyTorch?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

209 Views

In this we are going to use PyTorch to train a CNN to recognize handwritten digit classifier using the MNIST dataset.MNIST is a widely used dataset for hand-written classification task covering more than 70k labeled 28*28 pixel grayscale images of handwritten digits. The dataset contains almost 60k training images and 10k test images. Our job is to train a model using 60k training images and subsequently test its classification accuracy on 10k test images.InstallationFirst we need the MXNet latest version, for that just run the following on your terminal:$pip install mxnetAnd you will something like, Collecting mxnet Downloading https://files.pythonhosted.org/packages/60/6f/071f9ef51467f9f6cd35d1ad87156a29314033bbf78ad862a338b9eaf2e6/mxnet-1.2.0-py2.py3-none-win32.whl (12.8MB) ... Read More

Python module Newspaper for Article scraping & curation?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

373 Views

We can extract content in web pages from a variety of domains such as data mining, information retrieval etc. To extract information from the websites of newspapers and magazines we are going to use newspaper library.The main purpose of this library is to extract and curates the articles from the newspapers and similar websites.Installation:To Newspaper library installation, run in your terminal:$ pip install newspaper3kFor lxml dependencies, run below command in your terminal$pip install lxmlTo install PIL, run$pip install PillowThe NLP corpora will be downloaded:$ curl https://raw.githubusercontent.com/codelucas/newspaper/master/download_corpora.py | pythonThe python newpaper library is used to collect information associated with articles. This ... Read More

Wrapping C/C++ for Python using SWIG

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

1K+ Views

There are multiple ways to wrap your existing C or C++ functionality in Python. In this section, we are going to see how we can wrap C/C++ functionality with SWIG. Below are other options to wrap c/c++ functionality in python.Manual wrappingUsing pyrex to wrap C code.CtypesSIPBoost PythonSWIG (Simple Wrapper Interface Generator) is capable of wrapping C code with numerous other languages including Perl, Python, PHP, Ruby, Tcl, C#, Common Lisp (CLISP, Allegro, CL, UFFI, CFFI), Java, Modula-3 and OCAML. Swig also supports multiple interpreted and compiled Scheme implementations (like Guile, MzScheme, Chicken) are supported.But we will discuss its implementation with ... Read More

Advertisements