I recently started working with pthon, but I confess that I still have a lot to learn. Until now, I worked with csv file that contained only numbers, and then I was able to make the graphs. Now, I have a file that has a lot of other information that I need to filter and put in table form in a pdf report.
Can anybody help me? I'm desperate, because nothing I do has worked.
I need to leave only the lines that contain Pmax, Vmpp, Impp, Voc, Isc, Latitude, Longitude, Module Mfr and Module Model,LR6-72OPH-400M. I would have to put that information in the report.
This is the information that I have in csv file:
Índice de classificação, 1
Revisão do software para PC, 4.14.200
Arquivo de Projeto, Projeto 1
, MEDIÇÕES, PREDIÇÕES DE MODELO
Pmax,370,55825526322,391,525034197669
Vmpp,31.7313569622068,33.6048451457906
Impp,11.6779832550044,11.6508507180761
Voc,40.3250464005396,46.5232625691376,
Isc,12.6464848370233,12.5787395689962,
Medições do SolSensor
Irradiância (W/m^2), 1049,59436035156
Termopar de temperatura 1 (graus C), 28,7875
MODELS DETAILS
Irradiância usada no modelo (W/m^2),1054,40198998588,Método: Medido
Temperatura da célula usada no modelo (Deg C), 44,2890391861706,Método: SmartTemp
Latitude, -15,3
Longitude, -44,2
Fuso Horário,-3
Módulo Mfr, LONGi Green Energy Technology Co., Ltd.
Modelo do Módulo, LR6-72OPH-400M
Nº de Módulos em String,1
Nº de Strings em Paralelo,1
Inversor Mfr, Inversor Indefinido
Medidas IV:
|VOLTS |AMPS |WATTS |
| -------- | -------------- | -------------- |
|2.30079605983701|12.6464848370233|29.0969824838117|
|2.79026584832682|12.642460498173 |35.275825766873 |
|2.88208293466305|12.6444726675982|36.442418893098 |
|2.9738698384579 |12.6444726675982|37.6030158893755|
These values (table) are separated by "," in csv file.
Related
I have two tables. One table with the letters of different countries and a second table with a mapping of these letters to each other.
I need to make a query to get the mapped letters of the two languages. Can you tell me how this can be done optimally?
The letter table
id
letter
language
1
A
en
2
Ä
de
3
A
de
4
O
en
5
O
de
6
Ö
de
The letter mapping table
id
letter1(letterTable.id)
letter2(letterTable.id)
1
1
2
2
1
3
3
4
5
4
4
6
Would it be better to create a separate table for each alphabet?
Maybe there is some other architectural approach for this kind of letter matching? I would really appreciate it!
This can be achieved with a join that is restricted to the two languages you want to check:
select en.id as id_en,
en.letter as letter_en,
de.id as id_de,
de.letter as letter_de
from letter en
join letter_mapping lm on lm.letter1 = en.id
join letter de on de.id = lm.letter2 and de.language = 'de'
where en.language = 'en';
Online example
I am trying to retrieve data from a MySQL Database using RODBC with the
commands odbcConnect and sqlQuery. There are different tables in the
database and in some cases it works without any difficulties. Nevertheless I
get an error with some of them and it seems to be related to date format. Since I'm not familiar with MySQL I hope to get some ideas here.
My code looks as follows:
library(RODBC)
mycon<-odbcConnect("nicer_64")
> data1<-sqlQuery(mycon,paste("select PID, NAME, FIRSTNAME1, SEXE from a_patient;"))
> head(data1)
PID NAME FIRSTNAME1 SEXE
1 22145 PILLONEL GASTON ANTONIN 1
2 22146 PORCHER HENRIETTE MARIE 2
3 22147 PUGIN AUGUSTE JOSEPH 1
4 21437 HEIZ MARIE ANTOINETTE 2
5 21439 KALT OTTO 1
6 2144 BRUNNER MARIE 2
> data2<-sqlQuery(mycon,paste("select PID, NAME, FIRSTNAME1, BIRTHDATE, SEXE from a_patient;"))
Error in as.POSIXlt.character(x, tz, ...) :
la chaîne de caractères n'est pas dans un format standard non ambigu
> head(data2)
Error in head(data2) : object 'data2' not found
Many thanks in advance!
I have a database with a column that has geographical location data like this:
party_no ...misc_cols_in_between... loc_reverse_geoloc_adr
------------------------------------------------------------------------------------------------
013 ...data... 367 Cleta Tunnel, South Moriahton, Palestinian Territory
666 ...data... NULL
185 ...data... Schillerstraße 50-50, 08340, Schwarzenberg/Erzgeb., Sachsen, DE
267 ...data... 18701-18999 N County Road 2500E, Oakland, IL, 61943, US
389 ...data... Le Rocher-Percé, Québec, CA
666 ...data... 94531, Antioch, CA, US
185 ...data... 76 Willochra Rd, Salisbury Plain, South Australia, 5109, AU
As you can see, now all the geographical location data is the same format. I basically need to run multiple queries with one of them being for example, the max appearing city,state,country and to what party number its linked to.
Would wildcards using LIKE % be the best bet here? I'm thinking I need somewhere to parse out the data in the column on the comma delimiter, since it seems the city , state, and country are delimited by columns. However, sometimes the address is missing and the data isn't formatted the same at all times.
I have this code to get total and other fields. what I am interested in
to get total values with $ sign, comma and 02 decimal places, what will be
the best function to use to cover all these.
so the total should reflect like : $ 1,780.00
please advise
select distinct
c.givenname, c.familyname, s.total, p.title,
a.givenname+' '+a.familyname as artist
from
customers as c
join sales as s on c.id=s.customerid
join saleitems as si on s.id=si.saleid
join paintings as p on si.paintingid=p.id
join artists as a on p.artistid=a.id;
result I am getting is like this:
Aloysius Peace 1780.0000 Woman in Black (Femme en noir)Mary Cassatt
Amanda Lynn 1115.0000 Le Moulin de la Galette Pierre-Auguste Renoir
Amanda Lynn 1115.0000 Madamoiselle RiviereJean-Auguste-Dominique Ingres
Amanda Lynn 1115.0000 Pollard Willows With SETting SunVincent Van Gogh
Amelia Rate 2125.0000 Flowers in a Vase with Shells and InseBalthasar Van
Amelia Rate 2125.0000 The Meeting of St Anthony Abbot and St Paul in the
Amelia Rate 2125.0000 The Two Girlfriends Henri de Toulouse-Lautrec
Amelia Rate 2125.0000 Vision After the Sermon, Jacob Wrestling
Use this something like this in your code. (for MS SQL)
select '$' + cast(cast (s.total as decimal (9,2)) as varchar(20)) as price
I've been handed a task where I've been asked to make use of an SSIS 2008 package to create a CSV then FTP that CSV, following this tutorial here.
My query isn't quite ready.
I'm pulling results where the columns we're going after are coming out as rows. Been reading around on how to to do this with a cursor + stored procedure, but was wondering if anyone has conquered this obstacle with a simpler solution?
Query
SELECT
b.name as 'field',
a.value
FROM
[PROD_21C_Sitecore_Web].[dbo].[VersionedFields] a
INNER JOIN [PROD_21C_Sitecore_Web].[dbo].[Items] b
on a.FieldId = b.ID
WHERE
ItemId = '8C1D5767-FB1A-47A6-913C-E78AAC24ABC9'
Results
field value
-------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UnderGradYear 1972
Position1 <p>Cancer Centers of North Carolina, Asheville Hematology Oncology Associates - Medical Oncologist</p>
FellowshipCity1 Winston Salem, NC
FellowshipYear1 1981
__Updated by sitecore\cvance
Position3 <p>St. Joseph's Hospital - Subsection Chief of Hematology/ Oncology</p>
Languages {A5AB043B-86D3-4033-BEDD-928BCA0A13C3}
UnderGradCity Chapel Hill, NC
Interests <p></p>
Locations {6127E1AE-E2BF-4517-8BCB-46590AEB06A8}|{A7D2EA25-1B3F-48AE-B347-FC1E06F48202}
__Revision 22068c83-3504-4d89-a9bf-2a9e83a49ca3
LastName Paschal
FirstName Barton R.
MedicalSchoolCity Atlanta, GA
Fellowship1 <p>Bowman Gray School of Medicine - Medical Oncology</p>
FullName Barton R. paschal
UnderGradSchool University of North Carolina
Residency <p>Louisiana State University Medical Center - Internal Medicine</p>
ResidencyYear 1979
ResidencyCity Shreveport, LA
Specialities {B5B0F45A-E2BE-4F3F-92A6-C39C0D3016C5}|{4FCCE0BC-F3D4-4E27-AA7F-D436E61B2A1B}
AwardsHonors <p>Fellow, American College of Physicians, Phi Beta Kappa</p>
Position1City Asheville, NC
Position2City Asheville, NC
Title MD
__Created 20120509T085416
Internship <p>LSU Medical Center</p>
Photo <image mediaid="{C0F47AFC-CBAE-4043-A52F-BF8E344DC6DA}" mediapath="/Images/Physicians/paschal-web" src="~/media/Images/Physicians/paschal-web.jpg" alt="paschal" height="" width="" hspace="" vspace="" />
Position2 <p>Memorial Mission Hospital - Medical Oncologist & Chair, Department of Internal Medicine</p>
BoardCertifications Board Certified - Internal Medicine, Medical Oncology
Position3City Asheville, NC
__Updated 20130514T080506:635041155069332802
MedicalSchool Emory University School of Medicine - MD
Position4 <p>Hospice of Hendersonville County - Medical Director</p>
Position4City Henderson, NC
MedicalSchoolYear 1976
InternshipCity Shreveport, LA
InternshipYear 1979
ProfessionalAssociations {05E5C7FA-99DC-47C7-AC5E-2DA51D87DD1F}|{E519CAD2-C25F-4ADD-BD91-A4DEF861517B}|{67D7F01D-1695-4963-A149-EDF18354BBCC}
Thank you for looking.
Sounds like you want to PIVOT the data
SELECT
ItemId,
UnderGradYear,
Position1,
FellowshipCity1,
FellowshipYear1
-- add 'columns'
FROM
data -- this 'table' is the result of current query
PIVOT
(
MAX(value)
FOR field IN ([UnderGradYear], [Position1],
[FellowshipCity1], [FellowshipYear1]) -- add 'columns'
) PivotTable
demo
you can then use SSIS to create a CSV of result of above and FTP that file.
Edit: Alternatively you could also use the pivot transformation in SSIS rather than in T-SQL