我是新手使用熊猫,我只是不知道该怎么做:
我正在使用python.我(正确)安装了anaconda.在我的文件中,我只是创建一个DataFrame(首先从read_csv导入它,然后手动重新创建它以确保不是问题).当我打印(数据帧)时,它打印:
km | price
0 | 240000 | 3650
[...]
23 | 61789 | 8290
Run Code Online (Sandbox Code Playgroud)
当我做dataframe.info()时我得到了这个:
class 'pandas.core.frame.DataFrame'
Int64Index: 24 entries, 0 to 23
Data columns (total 2 columns):
km 24 non-null int64
price 24 non-null int64
dtypes: int64(2)
memory usage: 576.0 bytes
Run Code Online (Sandbox Code Playgroud)
哪个是完美的.但我尝试的任何其他简单功能只显示NOTHING.我尝试了dataframe.head(),dataframe ['km'],dataframe [3:6]等.没有错误,我的终端上只有一大碗什么都没有.
编辑以添加示例代码:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.set_option('max_columns', 50)
#df=pd.read_csv('data.csv')
data = {'km': [240000, 139800, 150500, 185530, 176000, 114800, 166800, 89000, 144500, 84000, 82029, 63060, 74000, 97500, …Run Code Online (Sandbox Code Playgroud)