In this set of Python Lecture slides I demonstrate Numpy arrays and functions with appropriate applications. Demo on Data structures are done with Pandas.
This document describes methods of trigonometric leveling to determine the elevation of points. It discusses using a theodolite to measure vertical angles and calculate heights based on trigonometric functions. The key methods covered are:
1. Direct and reciprocal methods of observation between two stations to eliminate corrections.
2. Determining heights when the base is accessible or inaccessible using one or two instrument stations, applying corrections for curvature and refraction based on distance.
3. Calculating heights when instrument stations are at different elevations, providing equations to solve for distance and elevation.
Today very high resolution DEM from satellite image data with resolution of about one meter allows to depict very detailed surface changes.
High resolution DEM increase accurate satellite image geometry and adding DGPS ground control points increases x.y.z accuracy.
Wrong positioning of objects or bad parameters calculation often result in bad image geometry.
From along track stereo pairs of VHR satellite optical data it’s possible to generate an automatic DEM.
Applications :
Ortho-rectification of satellite images, 3D display.
Creation of accurate topographic reference, relief maps.
Topographic profiles and contour generation.
Surface analysis.
Calculations of slope, orientation and shading.
Calculations of volume and elevation
Extraction of terrain and morphometric parameters.
Geomorphology and structural analysis.
Geological quantifications (dips, lithological thicknesses, faults and folds of geometry, etc.).
3D Reference map of resources extraction zones (quarries, open-pits).
Calculation of hydrographic networks and watershed basin.
Determination of hypsometric curves, knickpoints, etc.
Characterization of eroded areas.
Floods simulation, risks evaluation.
Volume calculation for restraints of dams.
An overlay operation is much more than a simple merging of linework; all the attributes of the features taking part in the overlay are carried through. In general, there are two methods for performing overlay analysis—feature overlay (overlaying points, lines, or polygons) and raster overlay. Some types of overlay analysis lend themselves to one or the other of these methods. Overlay analysis to find locations meeting certain criteria is often best done using raster overlay (although you can do it with feature data). Of course, this also depends on whether your data is already stored as features or raster. It may be worthwhile to convert the data from one format to the other to perform the analysis.
Weighted Overlay
Overlays several raster files using a common measurement scale and weights each according to its importance.
The weighted overlay table allows the calculation of a multiple criteria analysis between several raster files.
Raster- The raster of the criteria being weighted.
Influence- The influence of the raster compared to the other criteria as a percentage of 100.
Field- The field of the criteria raster to use for weighting.
Remap- The scaled weights for the criterion.
In addition to numerical values for the scaled weights in Remap, the following options are available:
Restricted- Assigns the restricted value (the minimum value of the evaluation scale set, minus one) to cells in the output, regardless of whether other input raster files have a different scale value set for that cell.
No data - Assigns No Data to cells in the output, regardless of whether other input raster files have a different scale value set for that cell.
THIS PRESENTATION IS TO HELP YOU PERFORM THE TASK STEP BY STEP.
Segmentation is a way of partitioning raster images into segments based on pixel values and locations. Pixels that are spatially connected and have similar values are grouped in a single segment.
Let's see how in ERDAS IMAGINE by Hexagon Geospatial.
1) Visual image interpretation of remote sensing data can be labor intensive and require extensive training, while digital analysis techniques allow for automated and more detailed spectral analysis.
2) Preprocessing steps such as geometric correction and radiometric calibration are often needed to remove distortions in remote sensing images before analysis.
3) Image enhancement techniques such as contrast stretching, filtering, and ratioing can increase separability of features by amplifying slight spectral differences in the data.
This document summarizes different techniques for fusing images from multiple sensors. It discusses how image fusion aims to reduce data volume while retaining important information. Single-sensor fusion involves fusing sequential images, while multi-sensor fusion overcomes single-sensor limitations. Key steps in image fusion systems include registration, preprocessing, and postprocessing. Common fusion methods discussed are in the spatial domain (e.g. weighted averaging, Brovey transform) and transform domain (e.g. discrete wavelet transform). The document evaluates different fusion methods for applications like remote sensing and medical imaging, finding the multiresolution analysis-based intensity modulation method most accurately reproduces high-resolution images.
This document discusses various methods for measuring height from aerial photographs:
1. Relief displacement - The shift in location of an object in a photo due to its height. Height can be calculated using the object's displacement, flying height, and distance from the photo center.
2. Shadow length - An object's height is calculated using the length of its shadow, the sun's angle, and trigonometric functions.
3. Stereoscopic parallax - Taking photos of the same object from different positions and measuring the difference in the object's position between photos. Differential and absolute parallax values are used to calculate height.
This document describes methods of trigonometric leveling to determine the elevation of points. It discusses using a theodolite to measure vertical angles and calculate heights based on trigonometric functions. The key methods covered are:
1. Direct and reciprocal methods of observation between two stations to eliminate corrections.
2. Determining heights when the base is accessible or inaccessible using one or two instrument stations, applying corrections for curvature and refraction based on distance.
3. Calculating heights when instrument stations are at different elevations, providing equations to solve for distance and elevation.
Today very high resolution DEM from satellite image data with resolution of about one meter allows to depict very detailed surface changes.
High resolution DEM increase accurate satellite image geometry and adding DGPS ground control points increases x.y.z accuracy.
Wrong positioning of objects or bad parameters calculation often result in bad image geometry.
From along track stereo pairs of VHR satellite optical data it’s possible to generate an automatic DEM.
Applications :
Ortho-rectification of satellite images, 3D display.
Creation of accurate topographic reference, relief maps.
Topographic profiles and contour generation.
Surface analysis.
Calculations of slope, orientation and shading.
Calculations of volume and elevation
Extraction of terrain and morphometric parameters.
Geomorphology and structural analysis.
Geological quantifications (dips, lithological thicknesses, faults and folds of geometry, etc.).
3D Reference map of resources extraction zones (quarries, open-pits).
Calculation of hydrographic networks and watershed basin.
Determination of hypsometric curves, knickpoints, etc.
Characterization of eroded areas.
Floods simulation, risks evaluation.
Volume calculation for restraints of dams.
An overlay operation is much more than a simple merging of linework; all the attributes of the features taking part in the overlay are carried through. In general, there are two methods for performing overlay analysis—feature overlay (overlaying points, lines, or polygons) and raster overlay. Some types of overlay analysis lend themselves to one or the other of these methods. Overlay analysis to find locations meeting certain criteria is often best done using raster overlay (although you can do it with feature data). Of course, this also depends on whether your data is already stored as features or raster. It may be worthwhile to convert the data from one format to the other to perform the analysis.
Weighted Overlay
Overlays several raster files using a common measurement scale and weights each according to its importance.
The weighted overlay table allows the calculation of a multiple criteria analysis between several raster files.
Raster- The raster of the criteria being weighted.
Influence- The influence of the raster compared to the other criteria as a percentage of 100.
Field- The field of the criteria raster to use for weighting.
Remap- The scaled weights for the criterion.
In addition to numerical values for the scaled weights in Remap, the following options are available:
Restricted- Assigns the restricted value (the minimum value of the evaluation scale set, minus one) to cells in the output, regardless of whether other input raster files have a different scale value set for that cell.
No data - Assigns No Data to cells in the output, regardless of whether other input raster files have a different scale value set for that cell.
THIS PRESENTATION IS TO HELP YOU PERFORM THE TASK STEP BY STEP.
Segmentation is a way of partitioning raster images into segments based on pixel values and locations. Pixels that are spatially connected and have similar values are grouped in a single segment.
Let's see how in ERDAS IMAGINE by Hexagon Geospatial.
1) Visual image interpretation of remote sensing data can be labor intensive and require extensive training, while digital analysis techniques allow for automated and more detailed spectral analysis.
2) Preprocessing steps such as geometric correction and radiometric calibration are often needed to remove distortions in remote sensing images before analysis.
3) Image enhancement techniques such as contrast stretching, filtering, and ratioing can increase separability of features by amplifying slight spectral differences in the data.
This document summarizes different techniques for fusing images from multiple sensors. It discusses how image fusion aims to reduce data volume while retaining important information. Single-sensor fusion involves fusing sequential images, while multi-sensor fusion overcomes single-sensor limitations. Key steps in image fusion systems include registration, preprocessing, and postprocessing. Common fusion methods discussed are in the spatial domain (e.g. weighted averaging, Brovey transform) and transform domain (e.g. discrete wavelet transform). The document evaluates different fusion methods for applications like remote sensing and medical imaging, finding the multiresolution analysis-based intensity modulation method most accurately reproduces high-resolution images.
This document discusses various methods for measuring height from aerial photographs:
1. Relief displacement - The shift in location of an object in a photo due to its height. Height can be calculated using the object's displacement, flying height, and distance from the photo center.
2. Shadow length - An object's height is calculated using the length of its shadow, the sun's angle, and trigonometric functions.
3. Stereoscopic parallax - Taking photos of the same object from different positions and measuring the difference in the object's position between photos. Differential and absolute parallax values are used to calculate height.
Metode pengikatan ke muka menentukan posisi titik dari dua titik acuan dengan mengukur sudut alfa dan beta secara serentak menggunakan dua alat. Metode pengikatan ke belakang menentukan posisi titik terhadap dua titik acuan dengan mengukur sudut alfa dan beta dari titik yang akan ditentukan posisinya menggunakan satu alat. Kedua metode melibatkan perhitungan koordinat titik berdasarkan sudut dan jarak
Laporan ini membahas proses pembuatan peta RBI skala 1:5000 dari data foto udara menggunakan software Summit Evolution. Prosesnya meliputi stereoplotting untuk mendigitasi unsur-unsur di foto udara, pembentukan DEM dan kontur, serta penyajian hasil akhir peta garis di AutoCAD.
The objective of image classification is to classify each pixel into only one class (crisp or hard classification) or to associate the pixel with many classes (fuzzy or soft classification). The classification techniques may be categorized either on the basis of training process (supervised and unsupervised) or on the basis of theoretical model (parametric and non-parametric).
Unsupervised classification is where the groupings of pixels with common characteristics are based on the software analysis of an image without the user providing sample classes. The computer uses techniques to determine which pixels are related and groups them into classes. The user can specify which algorism the software will use and the desired number of output classes but otherwise does not aid in the classification process. However, the user must have knowledge of the area being classified when the groupings of pixels with common characteristics produced by the computer have to be related to actual features on the ground (such as waterbodies, developed areas, forests, etc.).
Supervised classification is based on the idea that a user can select sample pixels in an image that are representative of specific classes and then direct the image processing software to use these training sites as references for the classification of all other pixels in the image. Input classes are selected based on the knowledge of the user. The user also sets the bounds for how similar other pixels must be to group them together. These bounds are often set based on the spectral characteristics of the input classes (AOI), plus or minus a certain increment (often based on “brightness” or strength of reflection in specific spectral bands). The user also designates the number of classes that the image is classified into.
THIS PRESENTATION IS TO HELP YOU PERFORM THE TASK STEP BY STEP.
Laporan Praktikum ER Mapper Koreksi Geometrik dan RadiometrikSally Indah N
Laporan ini membahas pengolahan data citra Landsat menggunakan perangkat lunak ERMapper untuk mengetahui kondisi permukaan bumi. Tahapan pengolahan datanya meliputi penggabungan beberapa band citra, koreksi geometrik dan radiometrik untuk memperbaiki kesalahan dan meningkatkan kualitas citra, serta pembentukan komposit band untuk memperoleh informasi yang lebih baik.
DTM/DEM generation involves creating digital models of terrain elevation from various data sources. A DTM provides height values referenced to positions and can include other terrain features, while a DEM only provides regular elevation values. Photogrammetry and remote sensing are common methods to acquire elevation data and generate DTMs/DEMs. The data often needs editing and filtering to remove errors and refine the models. Raster and TIN representations are common formats, with rasters using a grid and TINs using irregular triangles. Accuracy depends on factors like the data source and grid size for rasters. DSMs include above-ground features and require processing to derive bare earth DTMs below the features.
The document discusses different types of remote sensing scanners. It describes multispectral scanners, thematic mappers, thermal scanners, and hyperspectral scanners. Multispectral scanners collect data in multiple wavelength bands using either across-track or along-track scanning. Thematic mappers were developed to improve upon multispectral scanners. Thermal scanners sense the thermal infrared wavelength range. Hyperspectral scanners record over 100 contiguous spectral bands to generate a continuous reflectance spectrum for each pixel.
1. The document introduces concepts related to electromagnetic radiation and the electromagnetic spectrum. It discusses how electromagnetic waves are produced by oscillating electric and magnetic fields.
2. Key concepts in remote sensing are introduced such as the electromagnetic spectrum, radiant quantities, energy interactions of reflection, absorption and transmission, and thermal radiation properties.
3. Principles of thermal remote sensing are covered including Planck's law, Stefan-Boltzmann law, blackbody radiation, emissivity of graybodies and selective radiators, and Wien's displacement law.
This document discusses using supervised classification of aerial imagery to identify methamphetamine lab locations in Denver, Colorado. The researcher obtained 2008 meth lab location data and aerial images. He used ERDAS to perform supervised classification to identify healthy and unhealthy vegetation, then analyzed meth lab sites against control sites. The results showed no statistically significant difference between meth lab and control sites in Denver's urban environment, likely due to low image quality. Better identification may require higher quality images, more samples, and analysis in rural areas with open fields.
1. Scattering is the redirection of electromagnetic radiation by particles in the atmosphere and depends on the number, size, and wavelength of incoming radiation.
2. Rayleigh scattering occurs when particle sizes are much smaller than the wavelength of light, scattering shorter wavelengths more, which is why the sky appears blue.
3. Mie scattering occurs due to particles around the same size as the wavelength, like dust, smoke, and water vapor, affecting longer wavelengths.
This document discusses various methods for contrast enhancement of images, including:
- Local color correction, which enhances contrast locally rather than globally.
- Simplest color balance, which clips a percentage of dark and light pixels before normalization.
- Screened Poisson equation, which acts as a high-pass filter using a single contrast parameter. Implementations of these methods in various color spaces like RGB, HSI, HSV, and HSL are provided. Local color correction is shown to perform better than global gamma correction by handling both dark and bright areas simultaneously.
The document describes the specifications of several sensors used in Indian remote sensing satellites. LISS-I operated in four spectral bands with a resolution of 72m and swath width of 148km. LISS-II had higher resolution of 36.25m and smaller swath of 74km across four bands. LISS-III covered a 142km swath at 23.5m resolution in green, red, NIR and SWIR bands. LISS-IV could operate panchromatically at 5.8m or multispectrally like LISS-III with a swath of 23.9-70km for Resourcesat-1 or 70km for Resourcesat-2.
This document summarizes key concepts in geographic data quality and coordinate systems. It discusses the seven dimensions of geographic data quality according to NCDCDS and ICA: lineage, positional accuracy, attribute accuracy, logical consistency, completeness, temporal accuracy, and semantic accuracy. It also defines key terms like datum, geoid, and ellipsoid used in coordinate systems and for measuring positional accuracy of geographic data. Common coordinate systems are also outlined, including UTM, WGS84 and Everest 1830 used in India.
This document discusses different types of remote sensing systems used in civil engineering, including optical, photogrammetric, thermal, multispectral, hyperspectral, and panchromatic systems. It provides examples and specifications of various sensors, such as MODIS, AVIRIS, IKONOS, and WorldView. The document also covers digital image formats, photogrammetry, image distortions and displacements, reference ellipsoids, relief displacement, and methods of measuring heights from aerial photographs.
Aerial photography involves taking photographs from aircraft or other flying objects. It provides a synoptic view of large areas that allows for identifying small-scale features and spatial relationships. Interpreting aerial photographs involves detecting, recognizing, analyzing, deducing, classifying, and determining the accuracy of identified objects based on their tone, texture, pattern, shape, shadow, size, place, and associations with other objects. Key elements that aid interpretation include tone, texture, pattern, shape, shadow, and size.
Spatial resolution refers to the ability to distinguish between two close objects or fine detail in an image. It depends on properties of the imaging system, not just pixel count. Higher spatial resolution means finer details can be distinguished. Pixel count alone does not determine spatial resolution, as color images require interpolation between sensor pixels. Spatial resolution is measured differently for various media like film, digital cameras, microscopes, and more. It affects the ability to distinguish fine detail like gaps in a fence as distance increases.
SAR
SAR stands for specific absorption rate.
It measures the amount of radiation that is absorbed by human body.
The standard unit of SAR is kg/watt.
The maximum value limit allowed in India is 1.6 W/Kg, this calculation for SAR value is usually done by the manufacturers of the smartphones and then sold out in the market. Any smartphone having a SAR value more than this number cannot be sold in India.
The NumPy library provides multidimensional array objects and tools for working with these arrays. It allows users to create arrays, perform arithmetic operations on arrays, manipulate array shapes, combine and split arrays, and more. NumPy arrays can be inspected, saved/loaded from files, sorted, and copied.
The NumPy library provides multidimensional array objects and tools for working with these arrays. It allows users to create arrays, perform arithmetic operations on arrays, manipulate array shapes, combine and split arrays, and more. NumPy arrays can be inspected, saved to disk, sorted, and loaded from text files for data analysis.
Metode pengikatan ke muka menentukan posisi titik dari dua titik acuan dengan mengukur sudut alfa dan beta secara serentak menggunakan dua alat. Metode pengikatan ke belakang menentukan posisi titik terhadap dua titik acuan dengan mengukur sudut alfa dan beta dari titik yang akan ditentukan posisinya menggunakan satu alat. Kedua metode melibatkan perhitungan koordinat titik berdasarkan sudut dan jarak
Laporan ini membahas proses pembuatan peta RBI skala 1:5000 dari data foto udara menggunakan software Summit Evolution. Prosesnya meliputi stereoplotting untuk mendigitasi unsur-unsur di foto udara, pembentukan DEM dan kontur, serta penyajian hasil akhir peta garis di AutoCAD.
The objective of image classification is to classify each pixel into only one class (crisp or hard classification) or to associate the pixel with many classes (fuzzy or soft classification). The classification techniques may be categorized either on the basis of training process (supervised and unsupervised) or on the basis of theoretical model (parametric and non-parametric).
Unsupervised classification is where the groupings of pixels with common characteristics are based on the software analysis of an image without the user providing sample classes. The computer uses techniques to determine which pixels are related and groups them into classes. The user can specify which algorism the software will use and the desired number of output classes but otherwise does not aid in the classification process. However, the user must have knowledge of the area being classified when the groupings of pixels with common characteristics produced by the computer have to be related to actual features on the ground (such as waterbodies, developed areas, forests, etc.).
Supervised classification is based on the idea that a user can select sample pixels in an image that are representative of specific classes and then direct the image processing software to use these training sites as references for the classification of all other pixels in the image. Input classes are selected based on the knowledge of the user. The user also sets the bounds for how similar other pixels must be to group them together. These bounds are often set based on the spectral characteristics of the input classes (AOI), plus or minus a certain increment (often based on “brightness” or strength of reflection in specific spectral bands). The user also designates the number of classes that the image is classified into.
THIS PRESENTATION IS TO HELP YOU PERFORM THE TASK STEP BY STEP.
Laporan Praktikum ER Mapper Koreksi Geometrik dan RadiometrikSally Indah N
Laporan ini membahas pengolahan data citra Landsat menggunakan perangkat lunak ERMapper untuk mengetahui kondisi permukaan bumi. Tahapan pengolahan datanya meliputi penggabungan beberapa band citra, koreksi geometrik dan radiometrik untuk memperbaiki kesalahan dan meningkatkan kualitas citra, serta pembentukan komposit band untuk memperoleh informasi yang lebih baik.
DTM/DEM generation involves creating digital models of terrain elevation from various data sources. A DTM provides height values referenced to positions and can include other terrain features, while a DEM only provides regular elevation values. Photogrammetry and remote sensing are common methods to acquire elevation data and generate DTMs/DEMs. The data often needs editing and filtering to remove errors and refine the models. Raster and TIN representations are common formats, with rasters using a grid and TINs using irregular triangles. Accuracy depends on factors like the data source and grid size for rasters. DSMs include above-ground features and require processing to derive bare earth DTMs below the features.
The document discusses different types of remote sensing scanners. It describes multispectral scanners, thematic mappers, thermal scanners, and hyperspectral scanners. Multispectral scanners collect data in multiple wavelength bands using either across-track or along-track scanning. Thematic mappers were developed to improve upon multispectral scanners. Thermal scanners sense the thermal infrared wavelength range. Hyperspectral scanners record over 100 contiguous spectral bands to generate a continuous reflectance spectrum for each pixel.
1. The document introduces concepts related to electromagnetic radiation and the electromagnetic spectrum. It discusses how electromagnetic waves are produced by oscillating electric and magnetic fields.
2. Key concepts in remote sensing are introduced such as the electromagnetic spectrum, radiant quantities, energy interactions of reflection, absorption and transmission, and thermal radiation properties.
3. Principles of thermal remote sensing are covered including Planck's law, Stefan-Boltzmann law, blackbody radiation, emissivity of graybodies and selective radiators, and Wien's displacement law.
This document discusses using supervised classification of aerial imagery to identify methamphetamine lab locations in Denver, Colorado. The researcher obtained 2008 meth lab location data and aerial images. He used ERDAS to perform supervised classification to identify healthy and unhealthy vegetation, then analyzed meth lab sites against control sites. The results showed no statistically significant difference between meth lab and control sites in Denver's urban environment, likely due to low image quality. Better identification may require higher quality images, more samples, and analysis in rural areas with open fields.
1. Scattering is the redirection of electromagnetic radiation by particles in the atmosphere and depends on the number, size, and wavelength of incoming radiation.
2. Rayleigh scattering occurs when particle sizes are much smaller than the wavelength of light, scattering shorter wavelengths more, which is why the sky appears blue.
3. Mie scattering occurs due to particles around the same size as the wavelength, like dust, smoke, and water vapor, affecting longer wavelengths.
This document discusses various methods for contrast enhancement of images, including:
- Local color correction, which enhances contrast locally rather than globally.
- Simplest color balance, which clips a percentage of dark and light pixels before normalization.
- Screened Poisson equation, which acts as a high-pass filter using a single contrast parameter. Implementations of these methods in various color spaces like RGB, HSI, HSV, and HSL are provided. Local color correction is shown to perform better than global gamma correction by handling both dark and bright areas simultaneously.
The document describes the specifications of several sensors used in Indian remote sensing satellites. LISS-I operated in four spectral bands with a resolution of 72m and swath width of 148km. LISS-II had higher resolution of 36.25m and smaller swath of 74km across four bands. LISS-III covered a 142km swath at 23.5m resolution in green, red, NIR and SWIR bands. LISS-IV could operate panchromatically at 5.8m or multispectrally like LISS-III with a swath of 23.9-70km for Resourcesat-1 or 70km for Resourcesat-2.
This document summarizes key concepts in geographic data quality and coordinate systems. It discusses the seven dimensions of geographic data quality according to NCDCDS and ICA: lineage, positional accuracy, attribute accuracy, logical consistency, completeness, temporal accuracy, and semantic accuracy. It also defines key terms like datum, geoid, and ellipsoid used in coordinate systems and for measuring positional accuracy of geographic data. Common coordinate systems are also outlined, including UTM, WGS84 and Everest 1830 used in India.
This document discusses different types of remote sensing systems used in civil engineering, including optical, photogrammetric, thermal, multispectral, hyperspectral, and panchromatic systems. It provides examples and specifications of various sensors, such as MODIS, AVIRIS, IKONOS, and WorldView. The document also covers digital image formats, photogrammetry, image distortions and displacements, reference ellipsoids, relief displacement, and methods of measuring heights from aerial photographs.
Aerial photography involves taking photographs from aircraft or other flying objects. It provides a synoptic view of large areas that allows for identifying small-scale features and spatial relationships. Interpreting aerial photographs involves detecting, recognizing, analyzing, deducing, classifying, and determining the accuracy of identified objects based on their tone, texture, pattern, shape, shadow, size, place, and associations with other objects. Key elements that aid interpretation include tone, texture, pattern, shape, shadow, and size.
Spatial resolution refers to the ability to distinguish between two close objects or fine detail in an image. It depends on properties of the imaging system, not just pixel count. Higher spatial resolution means finer details can be distinguished. Pixel count alone does not determine spatial resolution, as color images require interpolation between sensor pixels. Spatial resolution is measured differently for various media like film, digital cameras, microscopes, and more. It affects the ability to distinguish fine detail like gaps in a fence as distance increases.
SAR
SAR stands for specific absorption rate.
It measures the amount of radiation that is absorbed by human body.
The standard unit of SAR is kg/watt.
The maximum value limit allowed in India is 1.6 W/Kg, this calculation for SAR value is usually done by the manufacturers of the smartphones and then sold out in the market. Any smartphone having a SAR value more than this number cannot be sold in India.
The NumPy library provides multidimensional array objects and tools for working with these arrays. It allows users to create arrays, perform arithmetic operations on arrays, manipulate array shapes, combine and split arrays, and more. NumPy arrays can be inspected, saved/loaded from files, sorted, and copied.
The NumPy library provides multidimensional array objects and tools for working with these arrays. It allows users to create arrays, perform arithmetic operations on arrays, manipulate array shapes, combine and split arrays, and more. NumPy arrays can be inspected, saved to disk, sorted, and loaded from text files for data analysis.
The NumPy library provides multidimensional array objects and tools for working with these arrays. It allows users to create arrays, perform arithmetic operations on arrays, manipulate array shapes, combine and split arrays, and more. NumPy arrays can be saved to and loaded from files to allow for inspection and persistence of array data.
Kickstart your data science journey with this Python cheat sheet that contains code examples for strings, lists, importing libraries and NumPy arrays.
Find more cheat sheets and learn data science with Python at www.datacamp.com.
This document provides an overview of selecting elements from lists and numpy arrays in Python. It demonstrates how to select a single element, slice a range of elements, select elements from nested lists and 2D numpy arrays. Various list and numpy array methods are also described, such as sorting, appending, inserting, deleting and calculating statistics.
This presentation is all about various built in
datastructures which we have in python.
List
Dictionary
Tuple
Set
and various methods present in each data structure
This document discusses Python data structures including lists, tuples, sets, and dictionaries. It provides examples and explanations of operations for each type. For lists, it covers creation, slicing, and common methods like append(), pop(), and sort(). For tuples, it notes they are immutable sequences. Sets are described as unordered collections with no duplicates. Dictionary operations are not discussed.
This document discusses Python data structures including lists, tuples, sets, and dictionaries. It provides examples and explanations of operations for each type. For lists, it covers creation, slicing, and common methods like append(), pop(), and sort(). For tuples, it notes they are immutable sequences. Sets are described as unordered collections with no duplicates. Dictionary operations are not discussed.
NumPy arrays can be broadcast together to perform arithmetic operations even if they have different shapes. Broadcasting duplicates smaller arrays to match the shape of larger arrays. It allows arrays with incompatible shapes to still be used together in arithmetic operations. This technique greatly simplifies code. Boolean arrays can be used to select, count, or modify values in NumPy arrays based on logical criteria using techniques like masking and fancy indexing.
This document discusses various Ruby array and string methods like capitalize, each_char, map, sample, shuffle, zip, and more. Code snippets demonstrate how to use these methods on arrays and strings in Ruby. The document also discusses using Node.js and IRB to test Ruby code snippets and the potential to write tests for Ruby code using a BDD style.
This document provides an overview of the Python programming language. It covers topics such as syntax, types and objects, operators and expressions, functions, classes and object-oriented programming, modules and packages, input/output, and the Python execution environment. It also discusses generators and iterators versus regular functions, namespaces and scopes, and classes in Python.
A tour of Python: slides from presentation given in 2012.
[Some slides are not properly rendered in SlideShare: the original is still available at http://www.aleksa.org/2015/04/python-presentation_7.html.]
The document discusses clustering and numpy arrays in Python. It shows how to create arrays using numpy, perform operations like summing and finding min/max values, and access elements and slices. It also introduces Cython and demonstrates compiling a simple "Hello World" Cython program and using Cython to optimize a Python prime number generation function for improved performance.
Effective Numerical Computation in NumPy and SciPyKimikazu Kato
This document provides an overview of effective numerical computation in NumPy and SciPy. It discusses how Python can be used for numerical computation tasks like differential equations, simulations, and machine learning. While Python is initially slower than languages like C, libraries like NumPy and SciPy allow Python code to achieve sufficient speed through techniques like broadcasting, indexing, and using sparse matrix representations. The document provides examples of how to efficiently perform tasks like applying functions element-wise to sparse matrices and calculating norms. It also presents a case study for efficiently computing a formula that appears in a machine learning paper using different sparse matrix representations in SciPy.
The document discusses various Python data structures and modules for working with data structures efficiently. It covers the abc module for defining abstract base classes, the array module for efficient storage of homogeneous data, the bisect module for working with sorted lists, the collections module which provides high-performance container data types like deque and defaultdict, namedtuple for creating tuple subclasses with named fields, heapq for priority queue implementation, and itertools for functions generating efficient iterators.
This document provides an overview of lists in Python. It defines lists as ordered, mutable sequences that can contain elements of different data types. Key features covered include: lists allow duplicates, are indexed and sliced, can be modified via assignment, support common operations like membership testing and iteration. Examples are provided for list construction, accessing/replacing items by index, slicing subsets, checking if an item exists, and looping through lists.
Similaire à Python for Data Science and Scientific Computing (20)
Codeless Generative AI Pipelines
(GenAI with Milvus)
https://ml.dssconf.pl/user.html#!/lecture/DSSML24-041a/rate
Discover the potential of real-time streaming in the context of GenAI as we delve into the intricacies of Apache NiFi and its capabilities. Learn how this tool can significantly simplify the data engineering workflow for GenAI applications, allowing you to focus on the creative aspects rather than the technical complexities. I will guide you through practical examples and use cases, showing the impact of automation on prompt building. From data ingestion to transformation and delivery, witness how Apache NiFi streamlines the entire pipeline, ensuring a smooth and hassle-free experience.
Timothy Spann
https://www.youtube.com/@FLaNK-Stack
https://medium.com/@tspann
https://www.datainmotion.dev/
milvus, unstructured data, vector database, zilliz, cloud, vectors, python, deep learning, generative ai, genai, nifi, kafka, flink, streaming, iot, edge
Learn SQL from basic queries to Advance queriesmanishkhaire30
Dive into the world of data analysis with our comprehensive guide on mastering SQL! This presentation offers a practical approach to learning SQL, focusing on real-world applications and hands-on practice. Whether you're a beginner or looking to sharpen your skills, this guide provides the tools you need to extract, analyze, and interpret data effectively.
Key Highlights:
Foundations of SQL: Understand the basics of SQL, including data retrieval, filtering, and aggregation.
Advanced Queries: Learn to craft complex queries to uncover deep insights from your data.
Data Trends and Patterns: Discover how to identify and interpret trends and patterns in your datasets.
Practical Examples: Follow step-by-step examples to apply SQL techniques in real-world scenarios.
Actionable Insights: Gain the skills to derive actionable insights that drive informed decision-making.
Join us on this journey to enhance your data analysis capabilities and unlock the full potential of SQL. Perfect for data enthusiasts, analysts, and anyone eager to harness the power of data!
#DataAnalysis #SQL #LearningSQL #DataInsights #DataScience #Analytics
Analysis insight about a Flyball dog competition team's performanceroli9797
Insight of my analysis about a Flyball dog competition team's last year performance. Find more: https://github.com/rolandnagy-ds/flyball_race_analysis/tree/main
Global Situational Awareness of A.I. and where its headedvikram sood
You can see the future first in San Francisco.
Over the past year, the talk of the town has shifted from $10 billion compute clusters to $100 billion clusters to trillion-dollar clusters. Every six months another zero is added to the boardroom plans. Behind the scenes, there’s a fierce scramble to secure every power contract still available for the rest of the decade, every voltage transformer that can possibly be procured. American big business is gearing up to pour trillions of dollars into a long-unseen mobilization of American industrial might. By the end of the decade, American electricity production will have grown tens of percent; from the shale fields of Pennsylvania to the solar farms of Nevada, hundreds of millions of GPUs will hum.
The AGI race has begun. We are building machines that can think and reason. By 2025/26, these machines will outpace college graduates. By the end of the decade, they will be smarter than you or I; we will have superintelligence, in the true sense of the word. Along the way, national security forces not seen in half a century will be un-leashed, and before long, The Project will be on. If we’re lucky, we’ll be in an all-out race with the CCP; if we’re unlucky, an all-out war.
Everyone is now talking about AI, but few have the faintest glimmer of what is about to hit them. Nvidia analysts still think 2024 might be close to the peak. Mainstream pundits are stuck on the wilful blindness of “it’s just predicting the next word”. They see only hype and business-as-usual; at most they entertain another internet-scale technological change.
Before long, the world will wake up. But right now, there are perhaps a few hundred people, most of them in San Francisco and the AI labs, that have situational awareness. Through whatever peculiar forces of fate, I have found myself amongst them. A few years ago, these people were derided as crazy—but they trusted the trendlines, which allowed them to correctly predict the AI advances of the past few years. Whether these people are also right about the next few years remains to be seen. But these are very smart people—the smartest people I have ever met—and they are the ones building this technology. Perhaps they will be an odd footnote in history, or perhaps they will go down in history like Szilard and Oppenheimer and Teller. If they are seeing the future even close to correctly, we are in for a wild ride.
Let me tell you what we see.
Open Source Contributions to Postgres: The Basics POSETTE 2024ElizabethGarrettChri
Postgres is the most advanced open-source database in the world and it's supported by a community, not a single company. So how does this work? How does code actually get into Postgres? I recently had a patch submitted and committed and I want to share what I learned in that process. I’ll give you an overview of Postgres versions and how the underlying project codebase functions. I’ll also show you the process for submitting a patch and getting that tested and committed.
The Ipsos - AI - Monitor 2024 Report.pdfSocial Samosa
According to Ipsos AI Monitor's 2024 report, 65% Indians said that products and services using AI have profoundly changed their daily life in the past 3-5 years.
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...sameer shah
"Join us for STATATHON, a dynamic 2-day event dedicated to exploring statistical knowledge and its real-world applications. From theory to practice, participants engage in intensive learning sessions, workshops, and challenges, fostering a deeper understanding of statistical methodologies and their significance in various fields."
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Aggregage
This webinar will explore cutting-edge, less familiar but powerful experimentation methodologies which address well-known limitations of standard A/B Testing. Designed for data and product leaders, this session aims to inspire the embrace of innovative approaches and provide insights into the frontiers of experimentation!
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data LakeWalaa Eldin Moustafa
Dynamic policy enforcement is becoming an increasingly important topic in today’s world where data privacy and compliance is a top priority for companies, individuals, and regulators alike. In these slides, we discuss how LinkedIn implements a powerful dynamic policy enforcement engine, called ViewShift, and integrates it within its data lake. We show the query engine architecture and how catalog implementations can automatically route table resolutions to compliance-enforcing SQL views. Such views have a set of very interesting properties: (1) They are auto-generated from declarative data annotations. (2) They respect user-level consent and preferences (3) They are context-aware, encoding a different set of transformations for different use cases (4) They are portable; while the SQL logic is only implemented in one SQL dialect, it is accessible in all engines.
#SQL #Views #Privacy #Compliance #DataLake
2. Arrays and Data Structures
• Numpy
• Pandas
2
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
3. ND Arrays by Numpy
>>> import numpy as np
>>> x = np.array([10, 20, 30])
>>> 10 in x
True
>>> 11 in x
False
3
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
16. Iterator
>>> import numpy as np
>>> x = np.array([10, 20, 30, 40])
>>> for i in x:
print i
10
20
30
40
>>> A = np.arange(0,60,5).reshape(3, 4)
>>> for i in A:
print i
[ 0 5 10 15]
[20 25 30 35]
[40 45 50 55]
16
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
17. >>> for i in np.nditer(A, order = 'F'):
print i
0
20
40
5
25
45
10
30
50
15
35
55
17
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
18. >>> for i in np.nditer(a, order = 'C'):
print i
0
5
10
15
20
25
30
35
40
45
50
55
18
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
19. Inserting Elements
>>> a = np.array([0, -1, 2, 5, 10])
>>> a.put(3, 99)
>>> a
array([ 0, -1, 2, 99, 10])
>>> np.insert(a, 3, 99)
array([ 0, -1, 2, 99, 5, 10])
19
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
64. Polynomial by Numpy
>>> from numpy import poly1d
>>> p = np.poly1d([1,2,3])
>>> print p
1 𝑥2
+ 2 𝑥 + 3
>>> p(2)
11
>>> p(-1)
2
>>> p.c # Coefficients
array([1, 2, 3])
>>> p.order # Order of the polynomial
2
64
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
65. Methods on Polynomials
>>> from numpy import poly1d as poly
>>> p1 = poly([1,5,6])
>>> p2 = poly([1,2])
>>> p1 + p2
poly1d([1, 6, 8])
>>> p1*p2
poly1d([ 1, 7, 16, 12])
>>> p1/p2
(poly1d([1., 3.]), poly1d([0.]))
>>> p2**2
poly1d([1, 4, 4])
>>> from numpy import sin
>>> sin(p2)
array([0.84147098, 0.90929743])
65
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
66. >>> p = np.poly1d([1, -5, 6])
>>> p.r
array([3., 2.]) # Real roots: 3, 2
>>> p.deriv(1) # First derivative
poly1d([2, 2])
>>> p.deriv(2) # Second derivative
poly1d([2])
>>> p.integ(1)
poly1d([0.33333333, 1. , 3. , 0. ])
>>> p.integ(2)
poly1d([0.08333333, 0.33333333,1.5,0.,0. ])
66
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
67. Plotting by Matplotlib
>>> import matplotlib.pyplot as plt
>>> x = [1, 2, 3, 4, 5]
>>> y = [1, 4, 9, 16, 25]
>>> plt.plot(x, y)
[<matplotlib.lines.Line2D object at
0x000000000BE00B70>]
>>> plt.show()
67
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
68. To plot the polynomial and
see…
68
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> x = np.linspace(-10,10,100)
>>> p = np.poly1d([1, 2, -3])
>>> y = p(x)
>>> plt.plot(x, y, lw = 3)
[<matplotlib.lines.Line2D object at
0x000000000C27A860>]
>>> plt.show()
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
70. Curve fitting by Polynomial
𝑥 0 10 20 30 40 50 60 70 80 90
𝑦 76 92 106 123 132 151 179 203 227 249
70
To fit the following data by a polynomial…
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
71. Step 1:
>>> import numpy as np
>>> x = np.array([0,10,20,30,40,50,60,70,80,90])
>>> y = np.array([76,92,106,123,132,151,179,203,227,249])
Step 2:
>>> import numpy.polynomial.polynomial as poly
>>> coeffs = poly.polyfit(x, y, 2)
>>> coeffs
array([7.81909091e+01, 1.10204545e+00, 9.12878788e-03])
Step 3:
>>> yfit = poly.polyval(x,coeffs)
>>> yfit
array([ 78.19090909, 90.12424242, 103.88333333,
119.46818182,136.87878788, 156.11515152, 177.17727273,
200.06515152,224.77878788, 251.31818182])
Step 4:
>>> import matplotlib.pyplot as plt
>>> plt.plot(x, y, x, yfit )
>>> plt.show() 71
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
72. Python Script for
Polynomial fitting
# Polynomial fitting by Numpy (with plot)
import numpy as np
import numpy.polynomial.polynomial as poly
import matplotlib.pyplot as plt
x = np.array([0,10,20,30,40,50,60,70,80,90])
y = np.array([76,92,106,123,132,151,179,203,227,249])
coeffs = poly.polyfit(x, y, 2)
yfit = poly.polyval(x, coeffs)
plt.plot(x, y, 'ko', x, yfit, 'k-')
plt.title('Fitting by polyfit', size = '20')
plt.show()
72
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
74. Fitting with user defined
function
# Input Data
>>> import numpy as np
>>> x = np.array([0,10,20,30,40,50,60,70,80,90])
>>> y = np.array([76,92,106,123,132,151,179,203,227,249])
# Define fitting function
>>> def f(x,a,b,c):
return a*x**2 + b*x + c
# Optimize the parameters
>>> from scipy.optimize import curve_fit
>>> par, var = curve_fit(f, x, y)
>>> a, b, c = par
# To plot and show
>>> import matplotlib.pyplot as plt
>>> plt.plot(x, y, x, f(x,a,b,c))
>>> plt.show()
74
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
75. Example Script: Fitting with
user defined function
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
x = np.array([-8, -6, -4, -2, -1, 0, 1, 2, 4, 6, 8])
y = np.array([99, 610, 1271, 1804, 1900, 1823, 1510,
1346, 635, 125, 24])
def f(x, a, b, c):
return a*np.exp(-b*(x-c)**2)
par, var = curve_fit(f,x,y)
a, b, c = par
plt.plot(x, y, 'o', x, f(x, a, b, c))
plt.show()
75
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
83. More towards Data Science…
83
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
84. PANDAS
Pandas deal with the following three
data structures:
• Series
• DataFrame
• Panel
These data structures are built over
Numpy arrays.
84
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
85. Series
>>> import pandas as pd
>>> import numpy as np
>>> x = np.arange(10,50,10)
>>> pd.Series(x)
0 10
1 20
2 30
3 40
dtype: int32
85
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
86. >>> index = ['a', 'b', 'c', 'd']
>>> pd.Series(x, index)
a 10
b 20
c 30
d 40
dtype: int32
>>> s = pd.Series(x, index)
>>> s[0]
10
>>> s[‘a’]
10
86
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
88. >>> s['e'] = 50
>>> s
a 10
b 20
c 30
d 40
e 50
dtype: int64
>>> data =['a', 'b', 'c', 'd']
>>> pd.Series(data)
0 a
1 b
2 c
3 d
dtype: object
88
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
89. # Data as scalar
>>> index = [‘a’, ‘b’, ‘c’, ‘d’]
>>> pd.Series(10, index, int)
a 10
b 10
c 10
d 10
dtype: int32
89
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
90. Series from Dictionary
>>> data = {'a':10, 'b':20, 'c':30, 'd':40}
>>> pd.Series(data)
a 10
b 20
c 30
d 40
dtype: int64
>>> index = ['a', 'b', 'c', 'd', 'e', 'f']
>>> pd.Series(data, index)
a 10.0
b 20.0
c 30.0
d 40.0
e NaN
f NaN
dtype: float64
90
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
91. Arithmetic operations on Series
>>> s
a 10
b 20
c 30
d 40
e 50
>>> s*2
a 20
b 40
c 60
d 80
e 100
>>> np.sqrt(s)
a 3.162278
b 4.472136
c 5.477226
d 6.324555
e 7.071068
dtype: float64 91
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
92. >>> sum(s)
150L
>>> min(s)
10L
>>> max(s)
50L
>>> s[1:4]
b 20
c 30
d 40
dtype: int64
>>> s.sum()
100
>>> s.mean()
25.0
>>> s.std()
12.909944487358056
92
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
94. >>> index = ['a','b']
>>> pd.DataFrame(x, index)
0 1 2 3
a 10 20 30 40
b 50 60 70 80
>>> d = pd.DataFrame(x,index,columns =
['A', 'B', 'C', 'D'])
A B C D
a 10 20 30 40
b 50 60 70 80
94
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
95. >>> d[‘A’]
a 10
b 50
>>> d[‘A’][‘a’]
10
95
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
97. DataFrame from the list of Dictionaries
>>> data = [{'x':2, 'y':10},{'x':4, 'y':20},{'x':6,
'y':30},{'x':8, 'y':40}]
>>> d = pd.DataFrame(data, index=[‘a’,’b’,’c’,’d’])
x y
a 2 10
b 4 20
c 6 30
d 8 40
>>> d['x']
a 2
b 4
c 6
d 8
Name: x, dtype: int64
>>> d['x'][‘b’]
4
97
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
98. DataFrame from Dictionary of Series
>>> index = ['a','b','c','d']
>>> s1 = pd.Series([10,20,30,40],index)
>>> s2 = pd.Series([100,200,300,400],index)
>>> d = {'A':s1, 'B':s2}
>>> pd.DataFrame(d)
A B
a 10 100
b 20 200
c 30 300
d 40 400
>>> D = pd.DataFrame(d)
>>> D['A']
a 10
b 20
c 30
d 40
Name: A, dtype: int64
98
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
99. Add column to DataFrame
>>> D['C']= pd.DataFrame({'C':pd.Series([1000,2000,3000,4000],index)})
>>> D
A B C
a 10 100 1000
b 20 200 2000
c 30 300 3000
d 40 400 4000
>>> D['C'] = pd.DataFrame(pd.Series([1000,2000,3000,4000],index))
>>> D
A B C
a 10 100 1000
b 20 200 2000
c 30 300 3000
d 40 400 4000
>>> D['C'] = pd.Series([1000,2000,3000,4000],index)
>>> D
A B C
a 10 100 1000
b 20 200 2000
c 30 300 3000
d 40 400 4000
99
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
100. Delete column and rows from DataFrame
>>> D
A B C
a 10 100 1000
b 20 200 2000
c 30 300 3000
d 40 400 4000
>>> del D['A']
>>> D
B C
a 100 1000
b 200 2000
c 300 3000
d 400 4000
100
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
101. Slicing
>>> D.loc['b']
A 20
B 200
C 2000
>>> D.iloc[1]
A 20
B 200
C 2000
Name: b, dtype: int64
>>> D[1:3]
A B C
b 20 200 2000
c 30 300 3000
>>> D[1:3]['A']
b 20
c 30
Name: A, dtype: int64
101
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
102. Append, Delete
>>> D1 = pd.DataFrame([[50,500,5000]], index =
['e'],columns=['A','B','C'])
>>> D1
A B C
e 50 500 5000
>>> D.append(D1) # Append another DataFrame
A B C
a 10 100 1000
b 20 200 2000
c 30 300 3000
d 40 400 4000
e 50 500 5000
>>> D.drop('a’) # Delete the indexed row.
A B C
b 20 200 2000
c 30 300 3000
d 40 400 4000
102
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
103. Re-indexing
>>> index = np.arange(1,6)
>>> d = pd.DataFrame(data, index, columns = ['x', 'y'])
>>> d
x y
1 0.1 0.2
2 0.3 0.4
3 0.5 0.6
4 0.7 0.8
5 0.9 1.0
>>> d.reindex(np.arange(2,7), ['x','y'])
x y
2 0.3 0.4
3 0.5 0.6
4 0.7 0.8
5 0.9 1.0
6 NaN NaN
103
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
104. Alignment of two DataFrames by
reindexing
>>> data = np.random.rand(10,3)
>>> d1 = pd.DataFrame(data, index = range(1,11), columns =
['x','y','z'])
>>> d1
x y z
1 0.342091 0.044060 0.773249
2 0.934012 0.038944 0.237909
3 0.670108 0.011794 0.831526
4 0.354686 0.381140 0.493882
5 0.690489 0.622695 0.409091
6 0.352255 0.205635 0.551726
7 0.371473 0.392713 0.853915
8 0.601222 0.353043 0.726287
9 0.933808 0.104148 0.718498
10 0.225576 0.812473 0.158370
104
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
105. >>> data = np.random.rand(8,3)
>>> d2 = pd.DataFrame(data, index = range(1,9),
columns = ['x','y','z'])
>>> d2
x y z
1 0.322780 0.376841 0.957168
2 0.892635 0.248012 0.705469
3 0.006545 0.050196 0.112410
4 0.886808 0.437421 0.658757
5 0.628429 0.961192 0.190440
6 0.374883 0.450280 0.983127
7 0.257246 0.776551 0.425495
8 0.939035 0.471483 0.810289
105
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
109. >>> index = ['a','b','c']
>>> data = {'A': pd.DataFrame(np.random.rand(3,4),index),
'B':pd.DataFrame(np.random.rand(3,4),index)}
>>> p = pd.Panel(data)
>>> p
<class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 3 (major_axis)
x 4 (minor_axis)
Items axis: A to B
Major_axis axis: a to c
Minor_axis axis: 0 to 3
109
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
110. >>> p.major_xs('a')
A B
0 0.422049 0.684155
1 0.922664 0.411938
2 0.644187 0.246746
3 0.213998 0.431654
>>> p.minor_xs(1)
A B
a 0.922664 0.411938
b 0.906779 0.573952
c 0.879191 0.233360
110
Abhijit Kar Gupta,
email: kg.abhi@gmail.com
112. >>> p.sum(1)
A B
0 1.210541 1.153222
1 2.708635 1.219250
2 1.481089 1.471627
3 1.289961 1.396990
>>> p.sum(2)
A B
a 2.202900 1.774494
b 2.619835 2.114777
c 1.867491 1.351817
112
Abhijit Kar Gupta,
email: kg.abhi@gmail.com