python panda修改csv文件不保存

时间:2014-10-19 11:32:30

标签: python csv numpy pandas

我有大文件,当我修改此文件时,我尝试保存文件,但终端显示错误。

 import pandas as pd
 from pandas import DataFrame
 import matplotlib.pyplot as plt 
 import numpy as np 
 def modifydataset():
      df = pd.read_csv('/home/najeeb/Downloads/stocks_sentdex.csv')

      df['time'] = pd.to_datetime(df['time'], unit='s')
      df = df.set_index('time')

      del df['id']

      df.to_csv('stocks_sentdex.csv')
 modifydataset()

错误显示在终端中:

File "/home/najeeb/PycharmProjects/pandaplotaa.py", line 16
   df.to_csv('stocks_sentdex.csv')
                              ^
  IndentationError: unindent does not match any outer indentation level

0 个答案:

没有答案