csv

datetime format for processing a CSV file [closed]

為{幸葍}努か 提交于 2021-01-29 20:10:49
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 days ago . Improve this question I am processing a CSV file. So the format in my CSV file is: 2020-10-26T03:45:00Z (example). How do I read this format to process the entire Excel sheet? for eg: for a date, we can time = datetime.strptimerow[0],'%Y/%d/%m') How can I use it similarly for my given format? here

Keras - ValueError: could not convert string to float

丶灬走出姿态 提交于 2021-01-29 19:30:42
问题 I have the code shown below, but get the following error: ValueError: could not convert string to float: BRAF Provided that this is a sample of my data ( | is just a separator I added here for demonstration, you can imagine each value in a separate cell in a CSV file): c.401C>T | skin | 23:141905805-141905805 | 9947 | BRAF Could the strings be the issue? How can I read and pass strings in this case? from keras.models import Sequential from keras.layers import Dense from keras.models import

How to edit .csv header row

强颜欢笑 提交于 2021-01-29 17:54:32
问题 I´m using a script to export Products from a shop to one .csv file. Now I need to change the header row to make it work for me. I was searching a long time but didn't get it how to make it work. maybe I'm just to silly for that. Lets say my CSV looks like this: Heading1 Heading2 Heading3 value1 value2 value3 Now I need to open that csv file, change just the Headings, close and save it. 回答1: $f = "file.csv"; $new_heading = "World,Mama,Euro"; $new_heading.="\n"; // read into array $arr = file(

How do I combine multiple CSV files into one excel files with different sheets using Python

可紊 提交于 2021-01-29 17:31:06
问题 I am trying to combine multiple csv files into one excel file whereby each file is it’s own sheet in the xls file. Below is a python script that can convert all csv files in a folder into there respective excel files. import os import glob import csv from xlsxwriter.workbook import Workbook """with open('output.csv', "rt", encoding = 'UTF-8') as fin: with open('outputconvert.csv', "wt", encoding = 'UTF-8') as fout: for line in fin: fout.write(line.replace(';',','))""" for csvfile in glob.glob

Changing delimiter in a loaded csv file

橙三吉。 提交于 2021-01-29 16:40:31
问题 I have loaded a csv file in memory. My csv file uses ";" as the field delimiter. It seems vba default delimiter is "," because when I try to access certain row and column of the loaded csv file, vba advances through the elements with refrence to number of "," used. example: In the 10th row of my data there are five columns: aa 12,34 bb 5,678 (here "," is decimal separator) in the csv file which the delimiter is ";" it looks like this: aa;12,34;bb;5,678 so when I write MyData(10,2) I am

Add-Content to CSV Powershell

前提是你 提交于 2021-01-29 15:51:52
问题 When I run the below code I get a list of details in separate columns. $file = 'c:\output\testing.csv' Get-AdUser -filter "DisplayName -eq 'joe bloggs'" | Get-ADUser -Properties * | Select-Object givenName, surname, mail, @{ Label = "Country" Expression = { if ($_.Country) { $_.Country } else { "GB" } } ,samaccountname, department, description | Export-csv -path $file Output (1) is as follows: +-----------+---------+-----------------+---------+----------------+------------+-------------+ |

How to sort CSV rows by a single column using PANDAS python

谁说我不能喝 提交于 2021-01-29 14:39:05
问题 Currently on my project I am trying to sort the rows of a CVS sheet by a singular column, I am using PANDAS and I have seen several examples posted all around the internet, however when trying to implement this myself I have been unable to. db = pd.read_csv(databasefile, skip_blank_lines=True, names=['ExampleOne','ExampleTwo','ExampleThree','ExampleFour'], header=1) db.drop_duplicates(inplace=True) db.sort_values(by=['ExampleOne'], ascending=[True]) db.to_csv(databasefile, index=False) In the

ParserError: Error tokenizing data. C error

痞子三分冷 提交于 2021-01-29 14:01:09
问题 i'm using a script ScriptGlobal.py that will call and execute 2 other scripts script1.py and script2.py exec(open("./script2.py").read()) AND exec(open("./script1.py").read()) The output of my script1 is the creation of csv file. df1.to_csv('file1.csv',index=False) The output of my script2 is the creation of another csv file. df2.to_csv('file2.csv',index=False) In my ScriptGlobal.py i want to read the 2 files file1.csv and file2.csv and then i got this error. ParserError: Error tokenizing

Lambda Function to write to csv and upload to S3

こ雲淡風輕ζ 提交于 2021-01-29 13:44:08
问题 I have a Python Script that gets the details of the unused security groups. I want that to write into a CSV file and upload to S3 Bucket. When I test it in local machine it writes to CSV in the local machine. But when I execute that as a lambda function, it needs a place to save the CSV. So I am using s3. import boto3 import csv ses = boto3.client('ses') def lambda_handler(event, context): with open('https://unused******- 1.amazonaws.com/Unused.csv', 'w') as csvfile: writer = csv.writer

find Math.min row value

守給你的承諾、 提交于 2021-01-29 13:23:55
问题 I want to find the row value of Math.min but I have no idea how to find this even though I have googled for a few days. Can someone tell how to solve this issue? function getDataPointsFromCSV(csv) { var dataPoints = csvLines = []; var price; var lowestv = Infinity; <!-- read csv file csvLines = csv.split(/[\r?\n|\r|\n]+/); <!-- read row 1-10 for (var i = 1; i <= 10; i++) if (csvLines[i].length > 0) { <!-- read csv file points = csvLines[i].split(","); <!-- read the data from points[4]=