In this article, we will discuss how to select a single column of data as a Series in Pandas.
For example, Suppose we have a data frame : Name Age MotherTongue Akash 21 Hindi Ashish 23 Marathi Diksha 21 Bhojpuri Radhika 20 Nepali Ayush 21 Punjabi
Now when we select column Mother Tongue as a Series we get the following output:
Hindi Marathi Bhojpuri Nepali Punjabi
Now let us try to implement this using Python:
Step1: Creating data frame:
Step 2: Selecting Column using dataframe.column name:
Step 3: Selecting column using dataframe[column_name]
In the above two examples we have used pd.Series() to select a single column of a data frame as a series.
- How to Select single column of a Pandas Dataframe?
- Select all columns, except one given column in a Pandas DataFrame
- Change the data type of a column or a Pandas Series
- Join two text columns into a single column in Pandas
- Get column index from column name of a given Pandas DataFrame
- Create a Pandas DataFrame from a Numpy array and specify the index column and column headers
- Add a Pandas series to another Pandas series
- Python | Pandas Series.select()
- Python | Pandas Series.astype() to convert Data type of series
- Convert given Pandas series into a dataframe with its index as another column on the dataframe
- How to select rows from a dataframe based on column values ?
- Add a new column in Pandas Data Frame Using a Dictionary
- How to extract Time data from an Excel file column using Pandas?
- Get the data type of column in Pandas - Python
- Python - Extract ith column values from jth column values
- Create a DataFrame from a Numpy array and specify the index column and column headers
- Python | Pandas series.cumprod() to find Cumulative product of a Series
- Python | Pandas Series.str.replace() to replace text in a series
- Python | Pandas Series.cumsum() to find cumulative sum of a Series
- Python | Pandas series.cummax() to find Cumulative maximum of a series
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.