Posts

Showing posts from August, 2023

Python -- Lists and Tuples

Image
 List and Tuple are built-in container types defined in Python. Objects of both these types can store different other objects that are accessible by index. List as well as tuple is a sequence data type, just as string. List as well as tuple can store objects which need not be of same type. List  : A List is an ordered collection of items (which may be of same or different types) separated by comma and enclosed in square brackets. Tuple:  Tuple looks similar to list. The only difference is that comma separated items of same or different type are enclosed in parentheses. Differences between List & Tuple: The obvious difference is the use of square brackets [] in List and parentheses () in tuple as enclosures. However, the important difference is that List as a mutable object and Tuple is an immutable object. If contents of an object can be modified in place, after it has been instantiated, is a mutable object. On the other hand, any operation on immutable object...

EDA using Pandas

Image
  1. Read data # Read data from csv file df = pd.read_csv('IMDB-Movie-Data.csv')     # Read data with specified index. df = pd.read_csv('IMDB-Movie-Data.csv', index_col="Title")   2. View data Let’s do a quick preview of the data by using head( ) and tail( ) methods head( )  Returns the top 5 rows in the dataset by default  It can also take the number of rows to be viewed as a parameter tail( ) Returns the bottom 5 rows in the dataset by default  3.Describe() which displays all statistical summary of all numerical attributes in the dataframe. df.describe() Extract data using rows loc  and iloc are two functions that can be used to slice data from specific row indexes. loc  – locates the rows by name loc  performs slicing based explicit index. It takes string indexes to retrieve data from specified rows iloc – locates the rows by integer index iloc performs slicing based on Python’s default...

Pandas in Python

Image
Pandas is built on top of the NumPy package, meaning a lot of the structure of NumPy is used or replicated in Pandas. Data in pandas is often used to feed statistical analysis in SciPy, plotting functions from Matplotlib, and machine learning algorithms in Scikit-learn. Jupyter Notebooks offer a good environment for using pandas to do data exploration and modeling, but pandas can also be used in text editors just as easily.   Install and import We can use 2 methods to install pandas   as below   Conda install pandas   Or   !pip3 install pandas   The “!” at the beginning runs cells as if they were in a terminal.   Alternatively, if you're currently viewing this article in a Jupyter notebook you can run this cell:   To import pandas we usually import it with a shorter name since it's used so much:   Import pandas as pd pd is the alias name for the pandas, so that it'll be easy to use that whenever it's required. Th...

What is NumPy & why it is used?

Image
  NumPy is a Python library created in 2005 that performs numerical calculations. It is used for working with arrays.It also includes a wide range of mathematical functions,such as linear algebra,random number generation etc, which can be applied to arrays. NumPy is generally used for 1.Machine Learning 2.Data Science 3.Image and signal Processing 4.Scientific Computing   Getting Started With NumPy In this Numpy tutorial, we will be using Jupyter Notebook, which is an open-source web application that comes with built-in packages and enables you to run code in real-time. Let’s get started by importing our NumPy module and writing basic code. NumPy is usually imported under the np alias. If NumPy is not installed, u can install through pip3/conda commands.     You can create a array with one-dimensional array shown below   The array object in NumPy is called ndarray which is also called as N-Dimension array.   NDIM: The ndi...

What is python

  Python programming language is a general purpose high-level language that is structural, procedural, and object-oriented programming. Like most programming languages, Python code supports classes, static methods, inheritance, etc., and this tutorial page covers everything. And the most crucial part is that it supports modules and packages which encourage code reusability in a program workflow. Why Learn Python programming language? Here are some reasons that are not limited to learning Python programming language. 1.It is trendy because it’s easy to learn code for beginners. 2.It has a simple syntax (like a spoken language) that makes people understand without effort. 3.Because of this, newbies can quickly start working on simple Python programs or even understand the complex codes written by professionals. 4.The most versatile language I have ever come across. We can use it for script purposes, web development, data analysis, reporting, and many more. 5.It’s open-sourc...

What causes the log full conditions and how to manage it?

  Long running transactions that can cause log full conditions affecting other applications include:   1) A LOAD operation, including ADMIN_MOVE_TABLE that makes use of LOAD. 2) A CREATE INDEX operation. 3) An idle application which has not issued COMMIT or ROLLBACK after modifying the database.   How can this be addressed? -------------------------------   Advanced Log Space Management (ALSM) helps to minimize application failures caused by log full errors (SQL0964N) as the result of a long running transaction holding back the active log space.   This is particularly useful if such a long running transaction does not generate much transaction log data in comparison to other concurrently running transactions.   With ALSM, the Db2 transaction manager identifies long running transactions that could be causing a log full condition and extracts (by copying) their log data from the active log files into separate extraction log files dedicated f...

How do you do software upgrades without downtime in DB2 HADR?

  You can perform DB2 Fixpack update on the servers configured with HADR setup.   Please follow the below steps to do that task   Steps to acheive it : --------------------- 1) First verify HADR is in peer state for both DB2 Primary and Standby. 2) Deactivate the HADR on the standby server. 3) Upgrade the standby server with the needed Fixpack version. 4) Start the standby again until it catches up with the primary server. 5) Issue a TAKEOVER command so that servers will change roles. 6) Suspend the new standby server. 7) Upgrade the new standby server. 8) Reactivate the new standby until it catches up with primary server. 9) Again operate the TAKEOVER command so that they will come back to their original primary and standby roles.

How do you test the integrity of db2 backup image

  If you want to test the integrity of the db2 backup image, db2 provides a wonderful utility called db2ckbkp It is used to check the backup integrity When db2ckbkp utility can be used? 1.use when a backup image appears to be corrupt 2.May also run proactively whenever a backup is taken 3.Can also be used to display meta-data stored within the backup image use db2ckbkp for different options