Skip to main content

Date-Time Fixer with Python

Sample of my Python Code




This is an example of some of my data management work.  I wrote a python code that combined date and time columns into a single date-time column and then formatted it into .ISO format.






import pandas as pd

# Load your data from a CSV file (adjust the filename and path accordingly)
file_path = 'riverdatacsv.csv'
df = pd.read_csv(file_path)

# Merge Date and Time columns into a single DateTime column with the ISO 8601 format
df['DateTime'] = pd.to_datetime(df['Date'] + ' ' + df['Time']).dt.strftime('%Y-%m-%dT%H:%M:%S')

# Drop the original Date and Time columns if needed
df = df.drop(['Date', 'Time'], axis=1)

# Display the DataFrame with the new DateTime column
print(df)

 

 

Comments

Popular posts from this blog

Meet Cuthbert Baines: A Passionate and High-Achieving Professional Programmer

   Hello, and welcome to my corner of the internet! I'm Cuthbert Baines, a seasoned computer programmer with a passion for solving complex problems and building efficient, scalable software. With years of experience in the industry, I’ve honed my skills to not only deliver high-quality code but also to contribute meaningfully to projects that push the boundaries of technology. My Journey into Programming I’ve always had a deep curiosity about how things work, which led me to the world of computer science and programming. From my first lines of code to tackling challenging algorithms, the journey has been a rewarding one. Over time, my focus has expanded to include full-stack development, machine learning, and software architecture, but the heart of my work remains in solving real-world problems with clean, maintainable code. What Sets Me Apart? As a professional programmer, I pride myself on a few key principles that guide my work: Attention to Detail : Whether I’m debu...

Unlocking the Power of Data: Why My Passion for Mathematics Makes Me the Ideal Candidate for Data Analytics

   Cuthbert Baines was probably the only person on his computing course at Hallam University who genuinely enjoyed every module that involved Data and Data Analysis.  In today’s fast-paced digital world, data is everywhere. From business trends to user behavior, data has the power to shape decisions, drive growth, and forecast future trends. However, data is only as valuable as the people who know how to interpret it. That’s where I come in. As someone with a deep passion for mathematics, I’ve honed the analytical skills needed to thrive in the world of data analytics. My journey has been one of both challenge and triumph, constantly pushing me to solve problems and unlock new insights. With a strong foundation in math, I’m not only capable of understanding complex datasets, but also transforming them into meaningful stories that can guide business strategy and decision-making. The Intersection of Mathematics and Data Analytics Mathematics isn’t just a subject I studie...

Exploring Life Through My Hobbies

      One of the simple joys in my life is going on walks. There's something incredibly refreshing about stepping out into the fresh air, whether it's a stroll through the park or an impromptu exploration of a new neighborhood. Walking gives me time to reflect, clear my mind, and discover small moments of beauty—like a perfectly blooming flower or the sound of birds chirping. It’s my form of meditation, grounding me in the present and helping me recharge for whatever comes next.        The cinema is another escape I hold dear. There’s an undeniable magic in watching a story unfold on the big screen. Whether it’s a thought-provoking indie film or the latest action-packed blockbuster, the cinema provides an immersive experience like no other. I love the way movies can stir emotions, spark ideas, and sometimes, even change my perspective on life. It’s one of those rare places where time seems to slow down, and you can get lost in someone else’s world fo...