python - How to parse_dates for the Imported CSV File in google colab ?? the CSV file is imported from the Local drive
问题描述
In Google Colab I have imported the CSV file from local drive, using the below code :
from google.colab import files
uploaded = files.upload()
then to read the CSV file to parse_date I have the below code :
import pandas as pd
import io
df = pd.read_csv(io.StringIO(uploaded['Auto.csv'], parse_dates = ['Date'],date_parser=parse))
print(df)
it show's the error message as below :
TypeError: StringIO() takes at most 2 arguments (3 given)
But when importing file from github it works good for example shown below :
df = pd.read_csv('https://raw.githubusercontent.com/master/dataset/electricity_consumption.csv', parse_dates = ['Bill_Date'],date_parser=parse) #this code works good from github
so I want to parse_dates for the csv file imported from the Local drive ??? Kindly help me on this???
Data set looks like this :
解决方案
推荐阅读
- ios - iOS IBOutlet 非零,不知何故被清除为零
- variables - 在最新的 Selenium IDE 中变量未增加
- reactjs - 如何将 React SPA 应用程序正确托管为 IIS 应用程序?
- regex - extract text from cells after string pattern in Excel
- octave - How to get the environment decimal separator in Octave
- sql - Case Statements in SQL - Nature of the Process
- java - Java EE:使用构造函数注入时 CDI 失败
- python - 使用scrapy在Stack Overflow中进行网络抓取,但我无法获得问题的投票
- python - How to permanently add values to python dictionaries
- javascript - 在 Chrome 中使用 JavaScript POST 将自定义 cookie 发送到另一个域