Situation and Behavioral
- Creating a Respectful, Supportive, and Encouraging Work Environment: Actions Taken
- Resolving ETL Performance Issues: Troubleshooting and Solutions
- Key Relevant Experiences from Previous Roles for Success in This Position
- Past Experience: Working with Data at Different Scales
- Distinguishing Stream Processing and Batch Processing: A Business-Friendly Explanation
- Key Relevant Experiences from Previous Roles for Success in This Position
- Explain when you discovered new use' case
- situation:Why you ideal Candidate for This Position
- Key Role in a Complex Project: Discussing a Demanding Work Experience
- Key Challenges in Data Engineering: Insights from a Data Engineer
- As a Data Engineer, My Professional Goals for the Year Ahead
- Python collections ChainMap<
- python tuples
- Python Lists
- python namedtuple
- Refined summary for your performance review
python namedtuple
Explore the benefits of using Python namedtuples—a convenient and readable way to define data structures with named fields. Learn how namedtuples enhance code clarity and organization in Python programming.
from collections import namedtuple
import csv
amountdisct =[]
with open("/Users/npblue/PycharmProjects/data/credit.csv", 'r') as file:
csvreader = csv.reader(file, delimiter=',')
count=0
for row in csvreader:
if count==0:
count += 1
Student = namedtuple('Student', row)
else:
amountdisct.append(Student(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7]))
print("type : ",type(amountdisct))
print(amountdisct)
for credittrasaction in amountdisct:
print(credittrasaction.AccountNumber)
def getMedian(lst):
sorted_lst = sorted(lst)
n = len(sorted_lst)
if n % 2 == 0:
middle1 = sorted_lst[n // 2 - 1]
middle2 = sorted_lst[n // 2]
median = (middle1 + middle2) / 2
else:
median = sorted_lst[n // 2]
return median
print("Type :",type(amountdisct))
print("min value :",min(amountdisct.values()))
print("max value :",max(amountdisct.values()))
print("mean value :",sum(amountdisct.values())//len(amountdisct.values()))
print("median value :",getMedian(amountdisct.values()))