I'm new to pandas so please go easy on me,
I'm changing the values in a specific column of my data frame by iterating through the column and changing it. the code is shown below.
row = 0
for values in nonNumericColumns['timestamp in UTC']:
values = values[:9]
nonNumericColumns.at[row, 'timestamp in UTC'] = values
row+=1
the values in the column before the change is :
0 2022-02-19T06:33:13.582610
1 2022-02-19T06:33:27.737695
2 2022-02-19T06:33:35.754507
3 2022-02-19T06:33:45.681506
4 2022-03-03T08:41:44.297195
5 2022-03-03T08:43:04.868416
6 2022-03-03T08:50:45.769626
7 2022-03-03T08:52:10.764062
8 2022-03-03T09:24:23.985866
9 2022-03-03T09:25:20.357228
10 2022-03-03T09:30:22.536442
11 2022-03-03T09:51:31.012427
now the values after the slicing is done are:
0 2022-02-1
1 2022-02-1
2 2022-02-1
3 2022-02-1
4 2022-03-0
5 2022-03-0
6 2022-03-0
7 2022-03-0
8 2022-03-0
9 2022-03-0
10 2022-03-0
11 2022-03-0
But the problem is that this method of iterating is making the program slow. can someone tell me how to make it efficient?
Any help would be appreciated.