0% found this document useful (0 votes)
4 views2 pages

Python Basics for Data Science and Finance

The document provides an overview of basic Python programming concepts, including syntax, variables, data structures like lists and dictionaries, and statistical functions. It also covers practical applications such as a simple interest calculator and financial analysis using the pandas library. Key examples illustrate how to implement these concepts in Python code.

Uploaded by

Marou fan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python Basics for Data Science and Finance

The document provides an overview of basic Python programming concepts, including syntax, variables, data structures like lists and dictionaries, and statistical functions. It also covers practical applications such as a simple interest calculator and financial analysis using the pandas library. Key examples illustrate how to implement these concepts in Python code.

Uploaded by

Marou fan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Programming

Basic Syntax

 Print Statement:

python
CopierModifier
print("Hello, World!")

 Variables:

python
CopierModifier
x = 10
y = "Data Science"

Data Structures

 Lists:

python
CopierModifier
my_list = [1, 2, 3, 4]

 Dictionaries:

python
CopierModifier
my_dict = {"key": "value"}

Probability and Statistics in Python

 Generating Random Numbers:

python
CopierModifier
import random
random_number = [Link](1, 100)

 Calculating Mean and Standard Deviation:

python
CopierModifier
import statistics
data = [10, 20, 30, 40]
mean = [Link](data)
std_dev = [Link](data)

Accounting Applications
 Simple Interest Calculator:

python
CopierModifier
def simple_interest(principal, rate, time):
return principal * rate * time

print(simple_interest(1000, 0.05, 2))

Financial Analysis with Libraries

 Using pandas for Data Analysis:

python
CopierModifier
import pandas as pd
data = {"Revenue": [1000, 1500, 2000], "Expenses": [500, 700, 800]}
df = [Link](data)
df["Profit"] = df["Revenue"] - df["Expenses"]
print(df)

You might also like