我有以下数据:
String Value datetime
hello 10 10/3/2017 0:00
hello 45 10/4/2017 0:00
hello 544 10/5/2017 0:00
hello 677 10/6/2017 0:00
hello 899 10/7/2017 0:00
hello 67 10/8/2017 0:00
hello 88 10/9/2017 0:00
hello 77 10/10/2017 0:00
Hi 55 10/3/2017 0:00
Hi 99 10/4/2017 0:00
Hi 33 10/5/2017 0:00
Hi 22 10/6/2017 0:00
Plant 11 10/3/2017 0:00
Plant 44 10/4/2017 0:00
Plant 55 10/5/2017 0:00
Plant 661 10/6/2017 0:00
我想找到字符串值之间的相关性,并用这三列绘制一个折线图,我正在使用以下代码:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_excel(r'test.xlsx')
df.head()
##to find the correlation between string and the value
s_corr = df.String.str.get_dummies(sep=' ').corrwith(df.Value)
print (s_corr)
#Plot the graph
df.set_index('datetime', inplace=True)
df.plot()
但是当我绘制图形时,它是用datetime和Value绘制的,但是我想用三列来绘制。怎么做?