How Can I Rewrite The Python Code Without Using Pandas Stack Overflow

How Can I Rewrite The Python Code Without Using Pandas Stack Overflow