Answers for "use values in a csv file python pandas"

4

read csv uisng pandas

import pandas as pd #import pandas
#syntax: pd.read_csv('file_location/file_name.csv')
data = pd.read_csv('filelocation/fileName.csv') #reading data from csv
Posted by: Guest on June-06-2020
1

pandas go through csv file

data = pd.read_csv(
    "data/files/complex_data_example.tsv",      # relative python path to subdirectory
    sep='t'           # Tab-separated value file.
    quotechar="'",        # single quote allowed as quote character
    dtype={"salary": int},             # Parse the salary column as an integer 
    usecols=['name', 'birth_date', 'salary'].   # Only load the three columns specified.
    parse_dates=['birth_date'],     # Intepret the birth_date column as a date
    skiprows=10,         # Skip the first 10 rows of the file
    na_values=['.', '??']       # Take any '.' or '??' values as NA
)
Posted by: Guest on February-27-2020

Code answers related to "use values in a csv file python pandas"

Python Answers by Framework

Browse Popular Code Answers by Language