passing multiple lists to pandas.Series

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



passing multiple lists to pandas.Series



This is the very simple code I wrote to begin with pandas.


import pandas
lst = [1,2,3,1,2,3]
lst2 = [5,6,7,5,6,7]
lst3 = [1,2,3,10,20,30]
s = pandas.Series(lst,lst2,lst3)



The output gives the error: datatype not understood.
Why is that and how do I fix it?


datatype not understood





what are you really looking for
– Onyambu
Aug 8 at 18:52





The output popped up error: data type not understood...but I got it later! thank you
– Priya
Aug 9 at 0:24




1 Answer
1



The simplest way to create pandas Series object is to use a list as you're trying:


import pandas as pd
lst = [1,2,3,1,2,3]
lst2 = [5,6,7,5,6,7]
lst3 = [1,2,3,10,20,30]
#But pandas series object accept only one argument for data. there are others like #index,name, etc
pd.Series(lst + lst2 + lst3)
#creates a series
0 1
1 2
2 3
3 1
4 2
5 3
6 5
7 6
8 7
9 5
10 6
11 7
12 1
13 2
14 3
15 10
16 20
17 30






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS