read.csv

read all fields of a csv file in python

read all fields of a csv file in python Question: I have a problem reading a csv file. Each line of the csv file is separated by , My edge.csv file looks like this: source,target,genre apple,banana,28 strawberry,mango,30 so on….. So this is my code for read edge.csv file: def read_net(filename): g = nx.Graph() with open(filename,encoding="ISO-8859-1",newline="") …

Total answers: 1

Python ValueError: could not convert string to float: '1,000000E+06'

Python ValueError: could not convert string to float: '1,000000E+06' Question: I have a list of around 70 string values, all of them with the E+(05 or 06), which they should be converted to float (as whenever i try to print the values, it somehow ignores the 100000 or 1000000). raw_data = ‘EISTest16_10CV_01.txt’ # name of …

Total answers: 2

read a csv file and validate whether input parameter is in the csv file then bypass the purge process otherwise initiate purge process using python

read a csv file and validate whether input parameter is in the csv file then bypass the purge process otherwise initiate purge process using python Question: sample csv file: test.csv process_cd ramsize dbsize protocal random function will be called with below parameters self.complete_stage_purge_process(self.targetCnxn, self.targetTable, self.processCode) sample process codes: test protocal forensic each time function is …

Total answers: 2

pandas.read_csv is ignoring quoting of strings

pandas.read_csv is ignoring quoting of strings Question: I am having some trouble reading/importing a csv file into a pandas dataframe. The import is not skipping the comma that is enclosed in quotes. I have tried different options for quotechar but none made any difference import csv import pandas df = pandas.read_csv( ‘test_quote.csv’, header=None,sep=’,’, quotechar=’"’, quoting=csv.QUOTE_MINIMAL, …

Total answers: 1

creating data frame from text file

creating data frame from text file Question: I have a dataset of over 1000 txt files which contains information of books The Project Gutenberg EBook of Apocolocyntosis, by Lucius Seneca This eBook is for the use of anyone anywhere at no cost and with almost no restrictions whatsoever. You may copy it, give it away …

Total answers: 1

error when I'm using a URL from a GitHub user dataset to use in python

error when I'm using a URL from a GitHub user dataset to use in python Question: Error tokenizing data. C error: Expected 1 fields in line 28, saw 367 I keep getting an error when I’m using a URL from a GitHub user dataset to use in python to run. Is there a way to …

Total answers: 2

Merge information from two files into one CSV file

Merge information from two files into one CSV file Question: For example 1st file contains names and dates separated by colon: john:01.01.2001 mary:06.03.2016 And then 2nd file contains names and cities: john:london mary:new york I need top merge them by names into csv file like that: name,town,date john,london,01.01.2001 mary,new york,06.03.2016 Also, if information about person …

Total answers: 1

Read .csv with different delimiters/separators

Read .csv with different delimiters/separators Question: I’m having a rough time trying to read this .csv file with pandas. "Sección;""Descripción Sección"";""Servicio"";""Descripción Servicio"";""Programa"";""Descripción Programa"";""Capítulo"";""Descripción Capítulo"";""Subconcepto"";""Descripción Subconcepto"";""Proyecto de Inversión"";""Nombre"";""CT"";""Isla"";""Importe""",,,, "01;""Parlamento"";""0101"";""Servicios Generales"";""911A"";""Actuación Legislativa y de Control "";""1"";""GASTOS DE PERSONAL"";""10000"";""Retrib.básic. y otras ret. del Gob.y altos Cargos"";"""";"""";"""";"""";3.836.041",,,, "01;""Parlamento"";""0101"";""Servicios Generales"";""911A"";""Actuación Legislativa y de Control "";""2"";""GASTOS CORRIENTES EN BIENES Y SERVICIOS"";""21900"";""Otro …

Total answers: 2

PythonPandasDataFrameCSV file: issue with csv file?

PythonPandasDataFrameCSV file: issue with csv file? Question: I’m a beginner in python programming. I was doing a school project with pandas with csv file and when I print the table it shows not the result I wanted This is the actual csv file i created csv file i created I hope anyone can help me …

Total answers: 2

Cant read .csv file. EmptyDataError: No columns to parse from file

Cant read .csv file. EmptyDataError: No columns to parse from file Question: I am using a MAC laptop to read my .csv file but this error shows up: EmptyDataError: No columns to parse from file. Here is a look at my data file: preview of the .csv file I even checked whether the filepath of …

Total answers: 3