如何将08:45时间转换为0845,以便我可以绘制时间序列降雨量 我在spyder中附加了图像数据框viwe
请帮助我
从评论中获取代码示例...
import numpy as np
import csv as csv
import pandas as pd
import datetime
import time
import matplotlib.pylab as plt
from mpl_toolkits.mplot3d import Axes3D
filename ='/home/yogesh/RTDAS 20 St.Data/Ambeghar_Rainfall.xls'
viewdata = pd.read_excel(filename, delimiter = ',',skiprows = 6,usecols=([3,4,5,6]))
index_col = 'Date'
fig1 = plt.figure(figsize=(25, 15))
ax1 = fig1.add_subplot(111)
plt.plot(viewdata["Today's Rain\n(mm)"])
plt.title("Rain Rate")
plt.show()
答案 0 :(得分:0)
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
filename ='/home/yogesh/RTDAS 20 St.Data/Ambeghar_Rainfall.xls'
# The standard variable name for a DataFrame is df.
df = pd.read_excel(filename, delimiter = ',', skiprows=6,usecols=([3,4,5,6]))
#I'm not sure if this is used later, or if you're trying to set index_col as your column name.
index_col = 'Date'
df = df.set_index(index_col)
# If you're only looking to plot a single column this is often easier:
df["Today's Rain\n(mm)"].plot(figsize=(25, 15))
plt.title("Rain Rate")
plt.show()