Home > database >  ValueError: DataFrame constructor not properly called! (WebScraping)
ValueError: DataFrame constructor not properly called! (WebScraping)

Time:01-06

While scraping at Console

CodePudding user response:

rawdata is already a DataFrame, you don't need to call pd.DataFrame:

>>> rawdata['records']['timestamp']
'06-Jan-2023 12:23:23'

>>> pd.Timestamp(rawdata['records']['timestamp'])
Timestamp('2023-01-06 12:23:23')

If you really want a DataFrame, use:

updateTime = pd.DataFrame([rawdata['records']['timestamp']])
#         Enclosed with --^                             --^
print(updateTime)

# Output
                      0
0  06-Jan-2023 12:23:23
  • Related