Problem of Datetime error in streamlit

Ask the community or our support engineers for answers to questions.
i am using streamlit 0.72 and python 3.6.9 in linux 18.04

i have code running in Jupyter Notebook/Lab which was ok.
however, when i Copy it to streamlit , it always pop 2 error
1)Can only use .dt accessor with datetimelike values
2)‘NoneType’ object has no attribute ‘total_seconds’

timestampstring Id
2020-11-05 10:48:51.990 123 3249
2020-11-05 11:39:22.566 234 1122
2020-11-05 16:48:20.200 123 3249
2020-11-05 17:35:20.575 234 1122
2020-11-06 22:45:47.100 123 3249
2020-11-06 23:15:02.661 234 1122
2020-11-07 04:45:13.127 123 3249

Problem is
A)
whenever i encounter (1),
i need to run
df[‘time’] = pd.to_datetime(df[‘time’]),
however, once i added to this,
(2) several line will run error
will appear following error and this would not be happen in Jupyter lab/notebook
“AttributeError: ‘NoneType’ object has no attribute ‘total_seconds’”

a) new_df = df.groupby([df[‘time’].dt.date])[‘use’].max().reset_index()
b) chart plot
c) st.write(df)

and from google i have reach timezone problem but it cant solve my case for settting UTC timezone
and in few try But not 100% guaurantee to resolve is that
i need to format my datetime
df[‘time’] = pd.to_datetime(df[‘time’] ,errors = ‘coerce’,format = ‘%Y-%m-%d %H’).dt.strftime(“%Y-%m-%d %H”)

The error was
AttributeError: ‘NoneType’ object has no attribute ‘total_seconds’

Traceback:

File "/home/user/Kat/Software/Data_science/dash/env/lib/python3.6/site-packages/streamlit/script_runner.py", line 332, in _run_script
    exec(code, module.__dict__)

File “/home/user/Jeff/Software/Data_science/cwmeter_dash/load_data_v0.py”, line 222, in run_table
st.write(df)
File “/home/user/Jeff/Software/Data_science/cwmeter_dash/env/lib/python3.6/site-packages/streamlit/elements/write.py”, line 169, in write
dg.dataframe(arg)
File “/home/user/Jeff/Software/Data_science/cwmeter_dash/env/lib/python3.6/site-packages/streamlit/elements/data_frame_proto.py”, line 82, in dataframe
marshall_data_frame(data, data_frame_proto)
File “/home/user/Jeff/Software/Data_science/cwmeter_dash/env/lib/python3.6/site-packages/streamlit/elements/data_frame_proto.py”, line 137, in marshall_data_frame
_marshall_table(df_data, proto_df.data)
File “/home/user/Jeff/Software/Data_science/cwmeter_dash/env/lib/python3.6/site-packages/streamlit/elements/data_frame_proto.py”, line 361, in _marshall_table
_marshall_any_array(pandas_array, proto_table.cols.add())
File “/home/user/Jeff/Software/Data_science/cwmeter_dash/env/lib/python3.6/site-packages/streamlit/elements/data_frame_proto.py”, line 404, in _marshall_any_array
pandas_array = pandas_array.dt.tz_localize(current_zone)
File “/home/user/Jeff/Software/Data_science/cwmeter_dash/env/lib/python3.6/site-packages/pandas/core/accessor.py”, line 99, in f
return self._delegate_method(name, *args, **kwargs)
File “/home/user/Jeff/Software/Data_science/cwmeter_dash/env/lib/python3.6/site-packages/pandas/core/indexes/accessors.py”, line 104, in _delegate_method
result = method(*args, **kwargs)
File “/home/user/Jeff/Software/Data_science/cwmeter_dash/env/lib/python3.6/site-packages/pandas/core/indexes/datetimes.py”, line 235, in tz_localize
arr = self._data.tz_localize(tz, ambiguous, nonexistent)
File “/home/user/Jeff/Software/Data_science/cwmeter_dash/env/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py”, line 972, in tz_localize
self.asi8, tz, ambiguous=ambiguous, nonexistent=nonexistent
File “pandas/_libs/tslibs/tzconversion.pyx”, line 175, in pandas._libs.tslibs.tzconversion.tz_localize_to_utc
File “pandas/_libs/tslibs/timezones.pyx”, line 238, in pandas._libs.tslibs.timezones.get_dst_info

I have the same problem. Can you solve it?

Did you solve the problem? I have the same error