Python
- key differences between List and Arrays
- Python collections ChainMap
- Array : Find median in an integer array
- Array : Find middle element in an integer array
- Array : Find out the duplicate in an array
- Array : Find print all subsets in an integer array
- Program : Array : Finding missing number between from 1 to n
- Array : Gap and Island problem
- Python collections
- Python Program stock max profit
- Reverse words in Python
- Python array duplicate program
- Coin change problem in python
- Python Write fibonacci series program
- Array : find all the pairs whose sum is equal to a given number
- Find smallest and largest number in array
- Iterate collections
- List comprehensions in Python
- key differences between List and Arrays
- Program: Calculate Pi in Python
- String Formatting in Python
- Python counters
- python tuples
- Python deque
- Python dictionary
- Python Lists
- python namedtuple
Python ChainMap
Dive into the world of ChainMap in Python—a powerful data structure for hierarchical dictionary chaining. Explore how ChainMap enhances data retrieval and manipulation, offering a versatile tool for managing interconnected data in your Python programming projects.
from collections import ChainMap
import csv
amountdisct =[]
data_chain=ChainMap()
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:
dist={}
dist[row[0]]=float(row[7])
print(dist)
data_chain = data_chain.new_child(dist)
print("type : ",type(data_chain))
print(data_chain)