Series
Pandas offers two primary data structures: Series
and DataFrame
. The Series
is the simpler of the two, resembling a one-dimensional array or a list. You can create a Series
object using the pd.Series()
constructor by passing a list as its argument.
12345import pandas as pd numbers = [17, 43, 74, 20] series = pd.Series(numbers) print(series)
You use the pd.Series()
constructor to create a Series
object that contains a list of numbers.
Swipe to start coding
You are given two lists: even_numbers
and states
.
- Create a
Series
namednumbers_series
from theeven_numbers
list. - Create a
Series
namedstates_series
from thestates
list.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
What is a DataFrame and how is it different from a Series?
Can I create a Series with custom index labels?
How do I access elements in a Series?
Awesome!
Completion rate improved to 3.03
Series
Swipe to show menu
Pandas offers two primary data structures: Series
and DataFrame
. The Series
is the simpler of the two, resembling a one-dimensional array or a list. You can create a Series
object using the pd.Series()
constructor by passing a list as its argument.
12345import pandas as pd numbers = [17, 43, 74, 20] series = pd.Series(numbers) print(series)
You use the pd.Series()
constructor to create a Series
object that contains a list of numbers.
Swipe to start coding
You are given two lists: even_numbers
and states
.
- Create a
Series
namednumbers_series
from theeven_numbers
list. - Create a
Series
namedstates_series
from thestates
list.
Solution
Thanks for your feedback!
single