I have dataframe, but all strings are duplicated and when I try print the graph, It contain duplicated column. I try to delete it, but then my graph print incorrectly. My csv is
It looks like your DataFrame
is not structure the way you would like it to be. Your DataFrame
contains 2014
and 2015
as column header names not as row values on the used_at
index. Also used_at
is the index name not the index label of the first row.
You can test that this is true by executing:
import pandas as pd
from cStringIO import StringIO
text_data = '''
used_at 2014 2015
address
am.ru 621 273
auto.ru 1752 1595
avito.ru 5460 4631
avtomarket.ru 314 215
cars.mail.ru/sale 457 271
drom.ru 1934 1623
e1.ru 1654 1359
irr.ru/cars 619 426
'''
# Read in tabular data with used_at row as header
df = pd.read_table(StringIO(text_data), sep='\s+', index_col=0)
print 'DataFrame created with used_at row as header:'
print df
print
# print df.used_at would cause AttributeError: 'DataFrame' object has no attribute 'used_at'
print 'df columns :', df.columns
print 'df index name :', df.index.name
print
DataFrame created with used_at row as header:
2014 2015
used_at
address NaN NaN
am.ru 621 273
auto.ru 1752 1595
avito.ru 5460 4631
avtomarket.ru 314 215
cars.mail.ru/sale 457 271
drom.ru 1934 1623
e1.ru 1654 1359
irr.ru/cars 619 426
df columns : Index([u'2014', u'2015'], dtype='object')
df index name : used_at