尝试在python中标记csv ...如何在附加代码的注释中加载图例
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import tarfile
import os
%matplotlib inline
%autosave 20
tar = tarfile.open('C:\Users\mpiercy\projects\sc-sessions-09-25.csv.tgz', mode='r:gz')
tar.extractall('C:\Users\mpiercy\projects\sc-sessions-09-25')
df = pd.read_csv('C:\Users\mpiercy\projects\sc-sessions-09-25\sc-sessions-09-25.csv', header=None)
df.head()
#site name, site id, start_time, end_time, energy_added, start_soe, end_soe
答案 0 :(得分:0)
听起来你想要标记列,你可以这样做:
df.columns = ('site_name', 'site_id', 'start_time', 'end_time', 'energy_added', 'start_soe', 'end_soe')