import-csv

how to get the column headers for CSV data with Powershell?

帅比萌擦擦* 提交于 2021-02-11 15:49:13
问题 How can I get the column headers for CSV data? Here is the specific data: PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labsURL='http://www.bccdc.ca/Health-Info-Site/Documents/BCCDC_COVID19_Dashboard_Lab_Information.csv' PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labs_csv=Invoke-RestMethod -Method Get -Uri $labsURL -Headers @{"Content-Type" = "text/csv"} PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labs =

how to get the column headers for CSV data with Powershell?

坚强是说给别人听的谎言 提交于 2021-02-11 15:47:24
问题 How can I get the column headers for CSV data? Here is the specific data: PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labsURL='http://www.bccdc.ca/Health-Info-Site/Documents/BCCDC_COVID19_Dashboard_Lab_Information.csv' PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labs_csv=Invoke-RestMethod -Method Get -Uri $labsURL -Headers @{"Content-Type" = "text/csv"} PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labs =

How to get data from csv into a python object

…衆ロ難τιáo~ 提交于 2021-01-18 19:14:09
问题 I am a beginner python user. Having trouble getting data from csv into python in the required object format to satisfy a python function. If I manually created the data in python (rather than bringing it in from csv) the following code works: class Student(object): pass john = Student() #score tuple john.score = (85.0, 42.0/2.0) bob = Student() bob.score = (45.0, 19.0/2.0) john.rank = 1 bob.rank = 2 ExternalCode.AdjustStudents([john, bob]) However I need it to work automatically and not have

How to pipe downloaded CSV data from Invoke-RestMethod to Import-CSV?

懵懂的女人 提交于 2020-12-15 04:54:51
问题 How can I represent, or at least view, this data? PS /home/nicholas> PS /home/nicholas> $labs='http://www.bccdc.ca/Health-Info-Site/Documents/BCCDC_COVID19_Dashboard_Lab_Information.csv' PS /home/nicholas> PS /home/nicholas> $labs_csv=Invoke-RestMethod -Method Get -Uri $labs -Headers @{"Content-Type" = "text/csv"} PS /home/nicholas> PS /home/nicholas> $labs_csv "Date","Region","New_Tests","Total_Tests","Positivity","Turn_Around" 2020-01-23,"BC",2,2,0,32 2020-01-23,"Fraser",0,0,0,0 2020-01-23,

Invalid input syntax for type integer in postgresql

柔情痞子 提交于 2020-02-25 04:41:10
问题 I'm trying to import a .csv file to my postgresql DB. I created a table as follows: CREATE TABLE accounts ( acc_id integer, acc_name text, website text, lat numeric, longe numeric, primary_poc text, sales_rep_id integer ) Then I used the following command to import the .csv file COPY accounts(acc_id,acc_name,website,lat,longe,primary_poc,sales_rep_id) FROM 'D:\accounts.csv' DELIMITER ';' CSV ; And my .csv file contains the following: 1;Walmart;www.walmart.com;40.23849561;-75.10329704;Tamara

How to keep leading zeros in a column when reading CSV with Pandas?

拜拜、爱过 提交于 2020-01-18 05:59:26
问题 I am importing study data into a Pandas data frame using read_csv . My subject codes are 6 numbers coding, among others, the day of birth. For some of my subjects this results in a code with a leading zero (e.g. "010816"). When I import into Pandas, the leading zero is stripped of and the column is formatted as int64 . Is there a way to import this column unchanged maybe as a string? I tried using a custom converter for the column, but it does not work - it seems as if the custom conversion

Import csv file with more than 1024 columns into new SQL Server table

偶尔善良 提交于 2020-01-04 05:42:24
问题 I am trying to upload data from CSV file into SQL Server which is 2GB in size and has more than 10000 columns. Please let me know how to load data with more than 1024 columns in SQL Server. I tried to do through Import/Export wizard,it threw below error Error 0xc002f210: Preparation SQL Task 1: Executing the query "CREATE TABLE [dbo].[Test] ( [ID] varchar(50)..." failed with the following error: "CREATE TABLE failed because column 'B19037Dm38' in table 'Test' exceeds the maximum of 1024

FileNotFoundError while importing a csv file using pandas in Jupyter notebook

ぐ巨炮叔叔 提交于 2020-01-01 06:34:05
问题 Screenshot of the described error. import pandas as pd df = pd.read_csv('/home/josepm/Documents/test_ver2.csv') --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-3-5cd7fd573fb7> in <module>() 1 import pandas as pd ----> 2 df = pd.read_csv('/home/josepm/Documents/test_ver2.csv') I try to import a CSV file using pandas and every time it says that it doesn't find the file. It's like Jupyter doesn't see

Find strings in one file in another and output certain columns

这一生的挚爱 提交于 2019-12-25 07:22:30
问题 I have a file that contains CampaignNames and IDs. The two fields are separated by a pipe | . The IDs are separated by a space. I want to find all rows in a file (thorpe þ delimited) that contain the IDs, and output those rows into separate files per name. This file is usually 4-7 GB, sometimes larger. campaigns.txt : Name|NameID FirstName|123 212 445 39 SecondName|313 939 ThirdName|219 Data ID File: DateþIDþCode 10-22-14þ123þAbc 10-24-16þ212þPow 09-18-15þ219 So I would want 3 files created.

Powershell .CSV values piped to select-objects returns empty records?

十年热恋 提交于 2019-12-24 19:53:09
问题 When i use import-csv to retrieve data from a .csv file I'm able to retrieve the data in the file in the console pane using Import-CSV: import-csv \\TestPath\licenses_v2.csv However, when i pipe that output to a select-object statement the same amount of rows are retrieved but they're now all empty. import-csv \\TestPath\licenses_v2.csv | select-object FirstName,LastName,Department,Title This occured after i began testing the following two seperate scripts, in an attempt to TRUNCATE before an