Programming Articles - Page 2462 of 3366

Processing time with Pandas DataFrame

Pavitra
Updated on 29-Aug-2019 06:44:37

212 Views

In this article, we will learn about generating & processing different timestamps using built-in pandas library. We are also using the numpy module to generate and modify the database needed for the timestamp generation.Preferable IDE: Jupyter notebookBefore beginning this tutorial we must install pandas and numpy library. For this jupyter notebook is the best place to test and run your code. For installing pandas we must run the following command.>>> pip install pandasIf we run this command all the dependencies are automatically installed. After it’s done we must restart the kernel to see the changes.After we finished installing all the ... Read More

First-Class Citizens in Python

Pavitra
Updated on 29-Aug-2019 06:37:15

3K+ Views

First-class citizens are entities that enable support for all the operations facilitating other fellow entities.These entities are often used : while passing an argument , returning a value from function , conditional modifications & value assignment.In this article, we will look at the implementation & usage of first-class citizens in Python 3.x or earlier. Also, we will be learning what all entities get the tag of being First Class citizens.These citizens include Variables along with functions.Let’s first get familiar with the data types that are part of First-class citizensIntegersFloating typeComplex NumbersStringsAll four types mentioned above are given the tag of ... Read More

Learning Model Building in Scikit-learn: A Python Machine Learning Library

Pavitra
Updated on 29-Aug-2019 06:20:30

300 Views

In this article, we will learn about the Learning Model Building in Scikit-learn: A Python Machine Learning Library.It is a free machine learning library. It supports various algorithm like the random forest, vector machines & k-nearest neighbours with direct implementation with numpy and scipy.Importing the datasetimport pandas Url = < specify your URL here> data=pandas.rad_csv(url)Data exploration and cleaningWe can use the head method to specify/filter the records according to our needs.data.head() data.head(n=4) # restricting the record to be 4We can also implement the last few records of the datasetdata.tail() data.tail(n=4) # restricting the record to be 4Now comes the stage ... Read More

How to print the elements of a HashMap in Java?

Vivek Verma
Updated on 18-Jun-2025 18:53:34

3K+ Views

In Java, a HashMap is a subclass of the AbstractMap class and is used to store key-value pairs. Each key in the map is mapped to a single value in the map, and the keys are unique.Printing Java HashMap Elements  We can insert a key only once in a map, and duplicate keys are not allowed, but the value can be mapped to multiple keys. We can add the elements using the put() method of the HashMap class and iterate over the elements using the Iterator interface. Java HashMap provides various ways to print its elements as follows: ... Read More

Keyboard module in Python

Pavitra
Updated on 28-Aug-2019 14:06:59

2K+ Views

In this article, we will learn about the use of the Keyboard module in Python 3.x. Or earlier.Ide preferred − Jupyter notebookInstallation −>>> pip install keyboardFunctionalities of the module −Allows us to block the action of specific keysWe can manage intents from the keyboard using on click listeners.Cross-platform compatibility.Supports special & hotkeys available on the keyboard.Now let’s implement this in the form of code −Exampleimport keyboard # It writes the content keyboard.write("Tutorialspoint") # It writes end of line keyboard.press_and_release('shift + o, shift + y, ') keyboard.press_and_release('k, j') # it blocks until ctrl keyboard.wait('Ctrl')OutputTutorialspoint O Y k jExampleimport keyboard # It ... Read More

Is the future with snake(Python) or Coffee(Java)?

Pavitra
Updated on 28-Aug-2019 14:04:53

185 Views

In this article, we will learn about the scope of python and java in implementing the upcoming and trending technologies with ease.JavaFeatures of javaIt is object-orientedIt’s is platform-independentInvolves distributed computing and network capabilitiesMultithreading is supportedSecurity is prioritizedThe stack allocation system is availableSupported/ Available frameworksSpring framework( web applications)Grails ( dynamic environment)Java server facesGoogle web toolkitPlay frameworkStruts frameworkPythonFeatures of pythonInterpreted Object-Oriented languageModular, Dynamic and robust in naturePortableCross-platform compatibilityExtensible in C/C++Extensive library and third part dependencies supportSupported/ Available frameworksDjango framework( web-based application)Flask ( webserver)Tornado ( Web sockets )Sanic framework ( multi-level handling)Giotto framework( full stack development)Bottle framework ( Rest API’s)ConclusionIn this article, we ... Read More

Introduction to Kivy; A Cross-platform Python Framework

Pavitra
Updated on 28-Aug-2019 13:56:32

846 Views

In this article, we will learn about Kivy framework and its installation. Kivy is a GUI based application interface, open-source that helps in cross-platform applications for Windows, Linux and Mac.Installation GuideFirstly we need to install python on pc.After that we need to install the dependencies −Windows −>>> python -m pip install docutils pygments pypiwin32kivy.deps.sdl2 kivy.deps.glew >>> python -m pip install kivy.deps.gstreamer >>> python -m pip install kivy.deps.angleLinux −$ sudo add-apt-repository ppa:kivy-team/kivyInstalling the Kivy fileWindows −>>> python -m pip install kivyLinux −>>> sudo apt-get install python3-kivyNow let’s see how we can make a graphical user interface using Kivy −Exampleimport kivy kivy.require('1.10.0') ... Read More

What is the Python Global Interpreter Lock (GIL)

Pavitra
Updated on 28-Aug-2019 13:52:08

387 Views

In this article, we will learn about What is the Python Global Interpreter Lock (GIL).This is a lock or hindrance that resistant the availability of the Python interpreter to multiple threads simultaneously. GIL is identified as a fault/issue in Python 3.x. Or earlier as it doesn’t allow multithreading in a multi-threaded architecture.Why is it introduced?Python supports the concept of automatic garbage collection. As soon as the reference count of an object reaches zero the memory is cleaned and free for usage.>>> import sys >>> var = {} >>> print(sys.getrefcount(ar)) >>> 2 >>> v=var >>> print(sys.getrefcount(v)) >>> 3Of in this case ... Read More

Vectorization in Python

Pavitra
Updated on 28-Aug-2019 13:47:51

1K+ Views

In this article, we will learn about vectorization and various techniques involved in implementation using Python 3.x. Or earlier.What is Vectorization?Vectorization is a technique to implement arrays without the use of loops. Using a function instead can help in minimizing the running time and execution time of code efficiently. Various operations are being performed over vector instead of arrays such as dot product of vectors which is also known as scalar product as it produces single output, outer products which results in square matrix of dimension equal to (length X length) of the vectors, Element wise multiplication which products the ... Read More

isprintable() in Python and its application

Pavitra
Updated on 28-Aug-2019 13:21:48

245 Views

In this article, we will learn about isprintable() in Python and its application.Is printable() is a built-in method used for the purpose of string handling. The isprintable() methods return “True” when all characters present in the string are of type printable or the string is empty, Otherwise, It returns a boolean value of “False”.Arguments − It doesn’t take any argument when calledList of printable characters include digits, letter, special symbols & spaces.Let’s look at this illustration to check that whether the characters of string are printable or not.Example Live Demo# checking for printable characters st= 'Tutorialspoint' print(st.isprintable()) # checking if ... Read More

Advertisements