Data-Frame-2

Wed 12 November 2025
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: py311; pyv: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0]'
print(pyu.ps2("pandas"))
pandas==2.2.3
import pandas as pd
d = {'col1': [1, 2], 'col2': [3, 4]}
#df = pd.DataFrame(data=d, dtype=np …

Category: pandas-work

Read More

Data-Pandas

Wed 12 November 2025
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: py311; pyv: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0]'
print(pyu.ps2("pandas"))
pandas==2.2.3
import pandas as pd
data = {'name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'], 
        'year': [2012, 2012, 2013, 2014, 2014], 
        'reports …

Category: pandas-work

Read More

Data3-Pandas

Wed 12 November 2025
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: py311; pyv: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0]'
print(pyu.ps2("pandas"))
pandas==2.2.3
import pandas as pd
import numpy as np
d = {'col1': [1, 2], 'col2': [3, 4]}

df = pd.DataFrame …

Category: pandas-work

Read More

Dataframe

Wed 12 November 2025
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: py311; pyv: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0]'
print(pyu.ps2("pandas"))
pandas==2.2.3
import pandas as pd
continents_and_medals = {};
continent = 'asia';
sports = {};
sports['athletics'] = 1;

continents_and_medals['asia'] = {};
continents_and_medals['asia']['fencing'] = 1;
print …

Category: pandas-work

Read More

Datet-Ime

Wed 12 November 2025
from datetime import datetime

def string_to_date(date_string):
    date_object = datetime.strptime(date_string, "%Y-%m-%d")
    return date_object

# Example usage
date_string = "2025-01-02"
result = string_to_date(date_string)
print(result)
2025-01-02 00:00:00
def check_leap_year(year):
    if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
        return "Leap year"
    else …

Category: python-basics

Read More

Def-Keyword

Wed 12 November 2025
#  created : 20250111
#  https://www.scientecheasy.com/2022/09/reserved-keywords-in-python.html/
#  def keyword
def func():
    print("Inside Function")
func()
Inside Function
#  return keyword
def func_return():
    x = 20
    return x

def func_no_return():
    y = 50

    return y
print(func_return())
20
print(func_no_return())
50
def func():
    x = 0
    for i in range(5):
        x …

Category: python-basics

Read More

Diamond-Problem

Wed 12 November 2025
class A:
    def display(self):
        print("hello jerin")

class B(A):
    pass

class C(A):
    pass

class D(B, C):
    pass

d = D()
b = B()
b.display()
d.display()
hello jerin
hello jerin


Score: 0

Category: python-basics

Read More

Dict-Merge

Wed 12 November 2025
def merge_dicts():
    # Define the two dictionaries inside the function
    my_dict1 = {'a': 1, 'b': 2, 'c': 3}
    my_dict2 = {'d': 4, 'e': 5, 'f': 6}

    # Method 1: Using dictionary unpacking
    result1 = {**my_dict1, **my_dict2}
    print("Method 1:", result1)

    # Method 2: Using copy and update
    result2 = my_dict1.copy()
    result2.update(my_dict2)
    print("Method 2 …

Category: python-basics

Read More

Donchain-Channel-2

Wed 12 November 2025
# Created: 20250104
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: py311; pyv: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0]'
print(pyu.ps2("requests"))
requests==2.32.3
import yfinance as yf
import pandas as pd
import matplotlib.pyplot as plt
# Step 1: Download …

Category: stockmarket

Read More

Email-Check

Wed 12 November 2025
# program to check a valid email 
import re
def email_check():
    email = input("Enter your email: ")

    if not email.endswith(".com"):
        print("Invalid: Email must end with '.com'")
        return

    if "@" not in email:
        print("Invalid: Email must contain '@'")
        return

    if email[0].isdigit():
        print("Invalid: Email should not start with a …

Category: python-basics

Read More
Page 3 of 10

« Prev Next »