Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Seaborn时间轴:显示日期而不是纳秒_Python_Date_Matplotlib_Seaborn - Fatal编程技术网

Python Seaborn时间轴:显示日期而不是纳秒

Python Seaborn时间轴:显示日期而不是纳秒,python,date,matplotlib,seaborn,Python,Date,Matplotlib,Seaborn,我有一个带有日期列的熊猫数据框(RankingDate) 此日期字段最初是从csv加载的字符串,格式为“2006-11-03” 运行df[“RankingDate”]=pd.to_datetime(df[“RankingDate”])后,数据类型变为,请参见。我不会太依赖tsplot,因为它可能会在将来的某个seaborn版本中被删除或发生重大更改-我想原因是它造成了很多混乱。是否有任何理由使用tsplot?为什么不使用标准线图?也许能帮上忙?看。我不会太依赖于tsplot,因为它可能会在未来的

我有一个带有日期列的熊猫数据框(
RankingDate

此日期字段最初是从csv加载的字符串,格式为“2006-11-03”


运行
df[“RankingDate”]=pd.to_datetime(df[“RankingDate”])
后,数据类型变为
,请参见。我不会太依赖
tsplot
,因为它可能会在将来的某个seaborn版本中被删除或发生重大更改-我想原因是它造成了很多混乱。是否有任何理由使用
tsplot
?为什么不使用标准线图?也许能帮上忙?看。我不会太依赖于
tsplot
,因为它可能会在未来的seaborn版本中被删除或有相当大的更改-我想原因是它引起了很多混乱。是否有任何理由使用
tsplot
?为什么不使用标准线图?也许能帮上忙?
f, ax = plt.subplots(figsize=(16, 8))
sns.tsplot(data, time='RankingDate', unit='Dummy', condition='Player', value='Points', ax=ax)
import numpy as np
import pandas as pd
import seaborn as sns
RankingDate = ['2015-03-02','2015-03-03','2015-03-04','2015-03-05','2015-03-06']
Player = ['Player1','Player2','Player2','Player1','Player1']
Points = np.random.randn(5)
df = pd.DataFrame({'RankingDate': RankingDate , 'Player': Player, 'Points': Points})
df["RankingDate"]=pd.to_datetime(df["RankingDate"])
df["Dummy"]=0

f, ax = plt.subplots(figsize=(16, 8))
sns.tsplot(df, time='RankingDate', unit='Dummy', condition='Player', value='Points', ax=ax)