Posts

Showing posts with the label DE with python

3.5 Plotting with Pandas

Image
  v   Plotting with pandas: -                     Example: -                     Output: -

4.4 Introduction of Plotly

Image
Plotly: - Plotly is a powerful and interactive plotting library in Python. Unlike Matplotlib, Plotly allows users to zoom, pan, hover, and interact with plots in real-time. It can create a wide variety of plots: line, scatter, bar, pie, bubble, 3D plots, maps, and dashboards.   Plotly can be installed using pip: py -m pip install plotly Modules of plotly are Plotly Express and Plotly Graph Objects. Plotly Express is a python visualization library for creating interactive and beautiful visualizations. it is used to produce professional and easy plots. Plotly Graph Objects are used to produce more complex plots than that of Plotly Express. Key Features of Plotly: - Interactive plots: Hover over points to see values, zoom into regions, or click legend items. Web-friendly: Plots can be embedded in web apps (e.g., using Dash). Multiple chart types: Supports advanced visualizations like 3D surfaces, choropleth maps, sunburst charts. Integration with Pandas: Directly plot Data...

4.3 Introduction of MATPLOTLIB

Image
  Introduction of   MATPLOTLIB: - Matplotlib is a popular Python library used for creating visualizations, including plots and graphs. Though Matplotlib is mainly for plotting, it can also help in generating sample data for visualization using functions like numpy integration. Generating data allows you to simulate real-world data for testing and analysis. To use Matplotlib for plotting and data generation, we usually import: numpy is used to generate numeric data like arrays, random numbers, or sequences.   Installing MatPlotLib: - Matplotlib can be installed by using command py -m pip install matplotlib Plotting with PYPLOT: - Matplotlib is a Python library for creating 2D plots and graphs. Pyplot is a submodule of Matplotlib that provides a Matlab-like interface for plotting. Using Pyplot, we can create line plots, scatter plots, bar charts, histograms, and more. To use Pyplot, we import Often, numpy is imported to generate or manage numeric data...

1.4 CSV file in Python

Image
  v   CSV file in python: - A CSV file in Python is a Comma-Separated Values file used to store tabular data in plain text format, where each line represents a row, and values in a row are separated by commas (,). Each row in the file corresponds to a record. Columns are separated by a delimiter (comma by default, but can be ;, \t, or others). CSV files are human-readable and can be opened in text editors, Excel, Google Sheets, etc. Python uses CSV module to read and write the CSV files.   1. Writing CSV files: - To write to a CS to write CSV file in Python, we use the csv.writer( ) method. The csv.writer( ) method returns a writer object that converts the user’s data into a delimited string. This string can later be used to write into CSV files using the writerow( ) method. The two methods for writing to CSV are: writerow( ): This method writes a single row at a time. Field row can be written using this method. writerows( ): This method is used t...

1.3 Pickle module in Python

Image
v   Pickle Module: - The pickle module in Python is used to serialize and deserialize Python objects. Serialization , also called pickling , is the process of converting a Python object into a byte stream so that it can be stored in a file or sent over a network. Deserialization , also called unpickling , is the process of converting a byte stream back into a Python object. The pickle module is useful for saving Python objects such as lists, dictionaries, sets, or custom objects in binary format. It can also be used to transfer Python data between programs, store program states, or save machine learning models for later use. We need to install pickle module before working upon its inbuilt methods using command prompt. The pickle module provides two methods: dump( ) and load( ). 1.   The pickle.dump( ) function serializes a Python object and writes it to a file in binary format.            ...

1.2 Binary files in python

Image
  v   Binary files in python: - A binary file is a file that stores data in the form of raw bytes (0s and 1s) instead of plain text. In Python, binary files store data in a non-text format such as images, audio files, videos, serialized objects, and more. Binary files consist of non-human-readable characters and symbols, which require specific programs to access their contents. They are stored as bytes (zeros and ones), but these bytes do not represent ASCII values of characters. Instead, they represent the actual content, such as images, audio, video, compressed files, executable files, etc. Since binary files are not human-readable, opening them in a text editor will display random or unreadable symbols, often referred to as “ garbage values ”. This happens because the computer interprets the binary content as a sequence of bytes without any text encoding. It is also difficult to remove errors from binary files, as their contents cannot be directly interpreted by humans. Py...

1.1 Files in python

Image
v   File: - File is a collection of data or information which is saved permanently in the non-volatile memory (Hard disk). Python supports file handling and allows the user to handle the files by read, write and other operations. Python supports two types of files: 1.       Text File. 2.       Binary File. 1) Text File: - Text file stores data in the form of text and readable by human and computer. Text files data is arranged in a structured as a sequence of lines. Each line is terminated with a special character called end of the line character (EOL). The most common special character comma (,) is used to represent new line character. 2) Binary File: - Binary file stores the data in the form of Binary and readable by computer only. Binary files can only be processed by an application that can understand the file structure. It can be performing the operations Like read and interpret binary. ·  ...