Created
March 22, 2019 21:49
-
-
Save prem0862/863f774bc2e41febf0e1c272974bef98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the Pandas libraries with alias 'pd' | |
import pandas as pd | |
file_name = "filename" | |
# Read data from file 'filename.csv' | |
# (in the same directory that your python process is based) | |
# Control delimiters, rows, column names with read_csv (see later) | |
data = pd.read_csv(file_name) | |
#print(data.head) | |
data_frame1 = data[['ID', 'A', 'B', 'C', 'D']] | |
data_frame2 = data[['DateTime']] | |
#print(data_frame2.head()) | |
data_frame2[['Date', 'Time']] = data_frame2.DateTime.str.split(' ', expand = True) | |
#print(data_frame2.head()) | |
df = data_frame1.join(data_frame2) | |
df_final = df[['ID', "Date", "Time", "A", "B", "C", "D"]] | |
print(df_final.head()) | |
df.to_csv("Sawant_chu 2.csv", sep='\t', encoding='utf-8') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment