csv

Sorting CSV with IP address column in pandas

Sorting CSV with IP address column in pandas Question: I have a CSV file with a column of IP addresses, MAC addresses and some other data. I want to sort all of the data by the IP addresses in ascending order Input: | IP Address | MAC Address | ID | | — | — …

Total answers: 1

How to feed multi-line grep output to xargs with multiple parameters from each line

How to feed multi-line grep output to xargs with multiple parameters from each line Question: I have a CSV file to grep from, where the number of columns may vary, e.g.: $ grep -v ‘Coba’ ETFs.csv | grep ‘Sector’ CAPE,Ossiam Shiller Barclays Cape Europe Sector Value TR,EUPE,FWB EUPB1,Ossiam Shiller Barclays Cape Global Sector Value,EUPB,FWB For …

Total answers: 2

Is there a really simple method for printing scraped output to a csv file?

Is there a really simple method for printing scraped output to a csv file? Question: Python: Python 3.11.2 Python Editor: PyCharm 2022.3.3 (Community Edition) – Build PC-223.8836.43 OS: Windows 11 Pro, 22H2, 22621.1413 Browser: Chrome 111.0.5563.65 (Official Build) (64-bit) I have a URL (e.g., https://dockets.justia.com/docket/puerto-rico/prdce/3:2023cv01127/175963) from which I’m scraping nine items. I’m looking to have …

Total answers: 3

Pyhton csv reader: loop over csv files

Pyhton csv reader: loop over csv files Question: I have several csv files that are named: list_csv_X with X going from 0 to 5. I would like to do a loop to read them with Python. I am currently doing it manually: for filepath in list_csv_0: with open(filepath,’r’,encoding="utf8", errors=’ignore’) as csvfile: BLABLABLA for filepath in …

Total answers: 2

Reading csv with numpy has extra row of 1's

Reading csv with numpy has extra row of 1's Question: I am using np.genfromtxt to read a csv file, and trying to use the converters argument to preprocess each column. CSV: "","Col1","Col2","Col3" "1","Cell.1",NA,1 "2","Cell.2",NA,NA "3","Cell.3",1,NA "4","Cell.4",NA,NA "5","Cell.5",NA,NA "6","Cell.6",1,NA Code: import numpy as np filename = ‘b.csv’ h = ("", "Col1", "Col2", "Col3") def col1_converter(v): print(f’col1_converter …

Total answers: 1

Loop through a string-list and make key:pair in json format in Python

Loop through a string-list and make key:pair in json format in Python Question: I have a csv file as: devid,1, devType,"type-928" devid,2, devType,"type-930" etc. Length of the lines might be different, depending on the number of key-pair values included. But must have ‘devid’ and ‘devType’ in them. Want to pair them as key:value and format …

Total answers: 2

Saving my csv output into file using python

Saving my csv output into file using python Question: I’m new to python and would like to learn data sets, I have following script to load and manipulate my csv file # import pandas with shortcut ‘pd’ import pandas as pd # read_csv function which is used to read the required CSV file data = …

Total answers: 1

Split CSV file into multiple files sorted my colum

Split CSV file into multiple files sorted my colum Question: Hi im a Python noob and i want to make a programm to split my csv file into multiple csv files the file looks something like this: main.csv Name;Lieferung;Name;Ort;Postleitzahl somename;60072470;somename;someadress;83620 somename;60071938;somename;someadress;48691 somename;60072194;somename;someadress;13595 somename;60072194;somename;someadress;13595 somename;60072511;somename;someadress;82140 and i want the code to automaticly create multiple csv files …

Total answers: 3

How we can take mean from several excel files place wise using python

How we can take mean from several excel files place wise using python Question: Link to Sample Data Files I have 13 excel files in a folder, each of the excel file have 100 columns and uncertain rows (i.e.- may be from 20 to 40 rows depending upon the resultant data). I want a single …

Total answers: 1