Posts

Showing posts from November, 2024

Different Data Plotting

Image
1. Line Plot Purpose : A line plot shows the trend of a variable over time or ordered categories. When to use : Ideal for showing time-series data or any continuous variable where the trend is important. Description : The x-axis represents the time or sequential order, and the y-axis represents the value of the variable. Data points are connected by lines to show how the variable changes. Example : A plot showing the stock price of a company over several months. import matplotlib.pyplot as plt import numpy as np # Example Data months = ['Jan', 'Feb', 'Mar', 'Apr', 'May'] stock_price = [100, 120, 130, 125, 140] plt.plot(months, stock_price, marker='o') plt.title('Stock Price Over Time') plt.xlabel('Month') plt.ylabel('Stock Price') plt.show() Visualization : A line graph with months on the x-axis and stock price on the y-axis, showing the trend of stock prices. 2. Scatter Plot Purpose : A scatter plot displays th...

Python Programming Tutorial

  Python is widely considered the best programming language for machine learning. It has gained immense popularity in the field of data science and machine learning. Python basics, Variables, Operators, Conditional Statements 1. Python Basics # Print a message print( "Welcome to Python Programming!" ) Output: Welcome to Python Programming ! 2. Variables # Variables are containers for storing data name = "Alice"       # String age = 25             # Integer height = 5.5         # Float is_student = True   # Boolean print( f"Name: {name}, Age: {age}, Height: {height}, Student: {is_student}" ) Output: Name: Alice, Age: 25 , Height: 5.5 , Student: True 3. Operators # Arithmetic Operators x, y = 10 , 3 print( "Addition:" , x + y) print( "Division:" , x / y) # Comparison Operators print( "Is x greater than y?" , x > y) # Logical Operators a, b = True , False print( "a and b:" , a and b) print( "a or b:...