Use of na_values parameter in read_csv() function of Pandas in Python Last Updated : 20 Mar, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report read_csv() is an important pandas function to read CSV files. But there are many other things one can do through this function only to change the returned object completely. In this post, we will see the use of the na_values parameter. na_values: This is used to create a string that considers pandas as NaN (Not a Number). by-default pandas consider #N/A, -NaN, -n/a, N/A, NULL etc as NaN value. let's see the example for better understanding. so this is our dataframe it has three column names, class, and total marks. now import the dataframe in python pandas. Example 1: see pandas consider #N/A as NaN. Python3 # import pandas library import pandas as pd # read a csv file df = pd.read_csv('Example.csv') # show the dataframe print(df) Output: Example 2: Now the na_values parameter is used to tell pandas they consider "not available" as NaN value and print NaN at the place of "not available". Python3 # import pandas library import pandas as pd # read a csv file df = pd.read_csv('Example.csv', na_values = "not available") # show the dataframe print(df) Output: Comment More infoAdvertise with us Next Article Python | Pandas DataFrame.fillna() to replace Null values in dataframe M mukulsomukesh Follow Improve Article Tags : Python Python-Quizzes Python-pandas Practice Tags : python Similar Reads Replacing missing values using Pandas in Python Dataset is a collection of attributes and rows. Data set can have missing data that are represented by NA in Python and in this article, we are going to replace missing values in this article We consider this data set: Dataset data set In our data contains missing values in quantity, price, bought, 2 min read Pandas Read CSV in Python CSV files are the Comma Separated Files. It allows users to load tabular data into a DataFrame, which is a powerful structure for data manipulation and analysis. To access data from the CSV file, we require a function read_csv() from Pandas that retrieves data in the form of the data frame. Hereâs a 6 min read Python | Pandas DataFrame.fillna() to replace Null values in dataframe Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Sometimes csv file has null values, which are later displayed as NaN in Data Frame. Ju 5 min read Extracting rows using Pandas .iloc[] in Python Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages that makes importing and analyzing data much easier. here we are learning how to Extract rows using Pandas .iloc[] in Python.Pandas .iloc[ 7 min read Pandas read_table() function Pandas is one of the most used packages for analyzing data, data exploration, and manipulation. While analyzing real-world data, we often use the URLs to perform different operations and Pandas provide multiple methods to read tabular data in Pandas. One of those methods is read_table() Pandas read_ 4 min read Python | Pandas Series.from_csv() Pandas series is a One-dimensional ndarray with axis labels. The labels need not be unique but must be a hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index. Pandas Series.from_csv() function is used t 2 min read Like