Reputation:
I want to change the time in the entire column to strings. Please provide the method with an example. Given below is my data.
timeseries CCN Number Conc SS
0 00:00:00 15.810967 0.1
1 00:05:00 358.401000 0.3
2 00:10:00 797.538333 0.5
given below is my code:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
load_file=pd.read_excel(r'E:\CCNC\CCNCCodes\Modulated output\Copy of Final_modulated_ccnc_data.xlsx',header=0)
load_file.columns
s=load_file.loc[0:289,['Timeseries',' CCN Number Conc','SS']]
Thank you.
Upvotes: 1
Views: 48
Reputation: 249123
Just tell Pandas to load the columns you want as strings:
pd.read_excel(filename, dtype={'Timeseries': str}, header=0)
That way you don't have to convert them later, which would waste time.
Upvotes: 1