Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Object pandas has no attribute name Series

import pandas as pd
numbers = {1,2,3,4,5}
ser = pd.Series(numbers)
print ser

I write this code in python for pandas series. but it's giving this

"AttributeError: 'module' object has no attribute 'Series'"

please help me

like image 578
Praveen.883 Avatar asked May 14 '15 01:05

Praveen.883


2 Answers

The Error in my problem is the file name.

I save the file as pandas.py that's why i got the error.

like image 88
Praveen.883 Avatar answered Oct 17 '22 17:10

Praveen.883


http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.html

data : array-like, dict, or scalar value Contains data stored in Series

Don't think a set counts as array-like, so just convert it to a list before calling pd.Series.

import pandas as pd
numbers = {1,2,3,4,5}
ser = pd.Series(list(numbers))

Output:

print ser

0    1
1    2
2    3
3    4
4    5
like image 31
Liam Foley Avatar answered Oct 17 '22 17:10

Liam Foley