PGC123

2020-04-01   阅读量: 4511

大数据 数据分析师 Python编程

读取一txt文件时,表格不对齐,如何处理?

扫码加入数据分析学习群

读取一txt文件时,表格不对齐,如何处理?

原始数据是这个样子的:

代码是这样写的:

name = pd.read_table('4-1.txt', sep = '\t', encoding ='utf-8', na_values="n/a")

答:这个数据没对齐的原因是pandas把第一列当作索引了。其实可以在读取数据的时候传递index_col参数设置相关信息。

通过这个参数可以告诉程序你数据中是否有索引、索引是哪一列。下面是函数文档对该参数的介绍。

index_col : int, str, sequence of int / str, or False, default ``None``
Column(s) to use as the row labels of the ``DataFrame``, either given as
string name or column index. If a sequence of int / str is given, a
MultiIndex is used.

Note: ``index_col=False`` can be used to force pandas to *not* use the first
column as the index, e.g. when you have a malformed file with delimiters at
the end of each line.

当我们数据中不含索引时,可以这样写:

name = pd.read_table('4-1.txt',sep = '\t', encoding ='utf-8', na_values="n/a",index_col=False)

这样pandas 会自动为我们填充一个自增的索引。

25.4390 3 6 关注作者 收藏

评论(2)

ermutuxia
2020-04-02

PT AU

J [Anonymous]

J Bustin, SA

感兴趣的同学可以自己新建立一个文本文件,然后把上面这几个数值粘贴到里面试着用正确的命令导入一下。

0.0000 0 0 回复
ermutuxia
2020-04-02
数值之间的分隔符为Tab键
0.0000 0 0 回复
PGC123
2020-04-02
PT	AU	BA	BE	GP	AF	BF	CA	TI	SO	SE	BS	LA	DT	CT	CY	CL	SP	HO	DE	ID	AB	C1	RP	EM	RI	OI	FU	FX	CR	NR	TC	Z9	U1	U2	PU	PI	PA	SN	EI	BN	J9	JI	PD	PY	VL	IS	PN	SU	SI	MA	BP	EP	AR	DI	D2	EA	PG	WC	SC	GA	UT	PM	OA	HC	HP	DA
J [Anonymous] [Anonymous] Scientific Working Group for Forensic Toxicology (SWGTOX) Standard Practices for Method Validation in Forensic Toxicology JOURNAL OF ANALYTICAL TOXICOLOGY English Article QUANTITATIVE ANALYTICAL PROCEDURES; BIOANALYTICAL METHODS VALIDATION; LIGAND-BINDING ASSAYS; SFSTP PROPOSAL; ELECTROSPRAY-IONIZATION; CHEMICAL-IONIZATION; STRATEGIES; HARMONIZATION; IMPLEMENTATION; SPECTROMETRY Araujo P, 2009, J CHROMATOGR B, V877, P2224, DOI 10.1016/j.jchromb.2008.09.030; Bressolle F, 1996, J CHROMATOGR B, V686, P3, DOI 10.1016/S0378-4347(96)00088-6; Bruce P, 1998, MIKROCHIM ACTA, V128, P93, DOI 10.1007/BF01242196; Clinical and Laboratory Standards Institute, 2007, C50 MASS SPECTR CLIN, V27; Corley J, 2003, FOODS HDB RESIDUE AN; Drummer OH, 2007, ANAL BIOANAL CHEM, V388, P1495, DOI 10.1007/s00216-007-1238-7; *EUR GUID, 1998, FITN PURP AN METH; Health Sciences Authority, 2004, GUID NOT AN METH VAL; Hubert P, 2004, J PHARMACEUT BIOMED, V36, P579, DOI 10.1016/j.jpba.2004.07.027; Hubert P, 2007, J PHARMACEUT BIOMED, V45, P70, DOI 10.1016/j.jpba.2007.06.013; Hubert P, 2007, J PHARMACEUT BIOMED, V45, P82, DOI 10.1016/j.jpba.2007.06.032; International Vocabulary of Metrology-Basic and General Concepts and Associated Terms (VIM), 2007, ISO IEC GUID 99 2007; Kushnir M M, 2004, CLIN BIOCHEM, V12, P319; Liang HR, 2003, RAPID COMMUN MASS SP, V17, P2815, DOI 10.1002/rcm.1268; Matuszewski BK, 2003, ANAL CHEM, V75, P3019, DOI 10.1021/ac020361s; Niedbala RS, IMMUNOASSAYS CLARKES; Peters FT, 2007, FORENSIC SCI INT, V165, P216, DOI 10.1016/j.forsciint.2006.05.021; Peters FT, 2002, ACCREDIT QUAL ASSUR, V7, P441, DOI 10.1007/s00769-002-0516-5; Peters FT, 2006, APPL LC MS TOXICOLOG; Remane D, 2010, RAPID COMMUN MASS SP, V24, P3103, DOI 10.1002/rcm.4736; Shah V, 2000, PHARM RES, V17, P1551; SHAH VP, 1992, PHARMACEUT RES, V9, P588, DOI 10.1023/A:1015829422034; Shultz E K, 1994, TIETZ TXB CLIN CHEM; Stockl D, 2009, J CHROMATOGR B, V877, P2180, DOI 10.1016/j.jchromb.2008.12.056; Thompson M, 2002, PURE APPL CHEM, V74, P835, DOI 10.1351/pac200274050835; *US DEP HLTH HUM S, 2001, GUID IND BIOAN METH; Van Eeckhaut A, 2009, J CHROMATOGR B, V877, P2198, DOI 10.1016/j.jchromb.2009.01.003; Viswanathan CT, 2007, PHARM RES, V24, P1962, DOI 10.1007/s11095-007-9291-7; Viswanathan CT, 2007, AAPS J, V9, pE30, DOI 10.1208/aapsj0901004 29 266 270 2 21 OXFORD UNIV PRESS INC CARY JOURNALS DEPT, 2001 EVANS RD, CARY, NC 27513 USA 0146-4760 J ANAL TOXICOL J. Anal. Toxicol. SEP 2013 37 7 452 474 10.1093/jat/bkt054 23 Chemistry, Analytical; Toxicology Chemistry; Toxicology 198WR WOS:000322954300010 23934984 Bronze 2020-04-01
J Bustin, SA Bustin, Stephen A. Why the need for qPCR publication guidelines?-The case for MIQE METHODS English Article PCR; qPCR; DNA; RNA; Quantification; Diagnostics REAL-TIME PCR; POLYMERASE-CHAIN-REACTION; REVERSE-TRANSCRIPTION PCR; COLORECTAL-CANCER PATIENTS; PERSISTING MEASLES-VIRUS; GENE-EXPRESSION; MESSENGER-RNA; RT-PCR; PERIPHERAL-BLOOD; QUANTITATIVE PCR The polymerase chain reaction (PCR) has matured from a labour- and time-intensive, low throughput qualitative gel-based technique to an easily automated, rapid, high throughput quantitative technology. Real-time quantitative PCR (qPCR) has become the benchmark technology for the detection and quantification of nucleic acids in a research, diagnostic, forensic and biotechnology setting. However, ill-assorted pre-assay conditions, poor assay design and inappropriate data analysis methodologies have resulted in the recurrent publication of data that are at best inconsistent and at worst irrelevant and even misleading. Furthermore, there is a lamentable lack of transparency of reporting, with the "Materials and Methods" sections of many publications, especially those with high impact factors, not fit for the purpose of evaluating the quality of any reported qPCR data. This poses a challenge to the integrity of the scientific literature, with serious consequences not just for basic research, but potentially calamitous implications for drug development and disease monitoring. These issues are being addressed by a set of guidelines that propose a minimum standard for the provision of information for qPCR experiments ("MIQE"). MIQE aims to restructure to-day's free-for-all OCR methods into a more consistent format that will encourage detailed auditing of experimental detail, data analysis and reporting principles. General implementation of these guidelines is an important requisite for the maturing of qPCR into a robust, accurate and reliable nucleic acid quantification technology. (C) 2009 Elsevier Inc. All rights reserved. Queen Mary Univ London, Barts & London Sch Med & Dent, Blizard Inst Cell & Mol Sci, London E1 1BB, England Bustin, SA (reprint author), Queen Mary Univ London, Barts & London Sch Med & Dent, Blizard Inst Cell & Mol Sci, London E1 1BB, England. s.a.bustin@qmul.ac.uk Bustin, Stephen/H-3086-2013 Bustin, Stephen/0000-0003-1870-6098 Bowel and Cancer Research [1119105] I am grateful to Bowel and Cancer Research (www.bowelcancerresearch.org/), registered charity number 1119105, for financial support. Afzal MA, 2006, J MED VIROL, V78, P623, DOI 10.1002/jmv.20585; Alvarez MJ, 2007, BMC BIOINFORMATICS, V8, DOI 10.1186/1471-2105-8-85; Asmann YW, 2008, GASTROENTEROLOGY, V135, P1466, DOI 10.1053/j.gastro.2008.09.042; Bahar R, 2006, NATURE, V441, P1011, DOI 10.1038/nature04844; Bengtsson M, 2005, GENOME RES, V15, P1388, DOI 10.1101/gr.3820805; Bengtsson M, 2008, BMC MOL BIOL, V9, DOI 10.1186/1471-2199-9-63; Bohlenius H, 2007, SCIENCE, V316, P367; Bostick PJ, 1998, J CLIN ONCOL, V16, P2632, DOI 10.1200/JCO.1998.16.8.2632; Burns M, 2008, EUR FOOD RES TECHNOL, V226, P1513, DOI 10.1007/s00217-007-0683-z; Burns MJ, 2005, BMC BIOTECHNOL, V5, DOI 10.1186/1472-6750-5-31; Bustin S.A., 2008, EUR PHARM REV, V6, P19; Bustin SA, 2005, CLIN SCI, V109, P365, DOI 10.1042/CS20050086; Bustin SA, 2000, J MOL ENDOCRINOL, V25, P169, DOI 10.1677/jme.0.0250169; Bustin SA, 2002, J MOL ENDOCRINOL, V29, DOI 10.1677/jme.0.0290023; BUSTIN SA, 2008, EUR PHARM REV, V4, P18; BUSTIN SA, 2008, EUR PHARM REV DIG, V1, P11; Bustin SA, 2008, BIOMARK MED, V2, P201, DOI 10.2217/17520363.2.3.201; Bustin Stephen A., 2006, Molecular Aspects of Medicine, V27, P192, DOI 10.1016/j.mam.2005.12.002; Bustin SA, 2006, PERS MED, V3, P207, DOI 10.2217/17410541.3.2.207; Bustin Stephen A, 2004, J Biomol Tech, V15, P155; Bustin SA, 2009, CLIN CHEM, V55, P611, DOI 10.1373/clinchem.2008.112797; Cai L, 2006, NATURE, V440, P358, DOI 10.1038/nature04599; Carthew RW, 2009, CELL, V136, P642, DOI 10.1016/j.cell.2009.01.035; Chen XW, 2008, HUM MOL GENET, V17, P1336, DOI 10.1093/hmg/ddn022; Cruz JA, 2009, CELL, V136, P604, DOI 10.1016/j.cell.2009.02.003; D'Souza Y, 2007, GUT, V56, P886, DOI 10.1136/gut.2006.119065; D'Souza Y, 2006, PEDIATRICS, V118, P1664, DOI 10.1542/peds.2006-1262; Djulbegovic B, 2007, PLOS MED, V4, P211, DOI 10.1371/journal.pmed.0040026; Eales JM, 2008, BMC BIOINFORMATICS, V9, DOI 10.1186/1471-2105-9-359; EDITORS PM, 2005, PLOS MED, V2, pE272; Fitzpatrick M, 2007, BRIT J GEN PRACT, V57, P679; Fleige Simone, 2006, Molecular Aspects of Medicine, V27, P126, DOI 10.1016/j.mam.2005.12.003; Fleige S, 2006, BIOTECHNOL LETT, V28, P1601, DOI 10.1007/s10529-006-9127-2; GALLUP JM, 2008, INT J BIOMED SCI, V4, P100; Garson JA, 2009, AIDS RES HUM RETROV, V25, P377, DOI 10.1089/aid.2008.0270; Guo JM, 2004, J MOL MED-JMM, V82, P768, DOI 10.1007/s00109-004-0590-8; Gutierrez L, 2008, PLANT CELL, V20, P1734, DOI 10.1105/tpc.108.059774; HAMMERLEFICKING.A, 2009, BIOTECHNOL LETT; Hampton R, 2002, ONCOGENE, V21, P7817, DOI 10.1038/sj.onc.1205906; Hayden RT, 2008, J CLIN MICROBIOL, V46, P157, DOI 10.1128/JCM.01252-07; He YP, 2008, SCIENCE, V322, P1855, DOI 10.1126/science.1163853; Hellemans J, 2007, GENOME BIOL, V8, DOI 10.1186/gb-2007-8-2-r19; Hornig M, 2008, PLOS ONE, V3, DOI 10.1371/journal.pone.0003140; Horrobin DF, 2003, NAT REV DRUG DISCOV, V2, P151, DOI 10.1038/nrd1012; Huang T, 2005, SCIENCE, V309, P1694, DOI 10.1126/science.1117768; Huggett J, 2005, GENES IMMUN, V6, P279, DOI 10.1038/sj.gene.6364190; Iinuma H, 2006, INT J ONCOL, V28, P297; Ioannidis JPA, 2005, PLOS MED, V2, P696, DOI 10.1371/journal.pmed.0020124; Ioannidis JPA, 2005, J CLIN EPIDEMIOL, V58, P543, DOI 10.1016/j.jclinepi.2004.10.019; Ito S, 2002, CANCER LETT, V183, P195, DOI 10.1016/S0304-3835(02)00157-X; Jin N, 2006, PHYSIOL GENOMICS, V25, P525, DOI 10.1152/physiolgenomics.00233.2005; Kaern M, 2005, NAT REV GENET, V6, P451, DOI 10.1038/nrg1615; Karlen Y, 2007, BMC BIOINFORMATICS, V8, DOI 10.1186/1471-2105-8-131; Klein D, 2002, TRENDS MOL MED, V8, P257, DOI 10.1016/S1471-4914(02)02355-9; KLEPPE K, 1971, J MOL BIOL, V56, P341, DOI 10.1016/0022-2836(71)90469-4; Laperche S, 2007, J CLIN MICROBIOL, V45, P3788, DOI 10.1128/JCM.00825-07; LEFEVER S, 2009, NUCL ACIDS RES; Lefever S, 2009, NUCLEIC ACIDS RES, V37, pD942, DOI 10.1093/nar/gkn777; Levin JZ, 2009, GENOME BIOL, V10, DOI 10.1186/gb-2009-10-10-r115; LISTER R, 2009, NATURE; Livak KJ, 2001, METHODS, V25, P402, DOI 10.1006/meth.2001.1262; Lo HS, 2003, GENOME RES, V13, P1855, DOI 10.1101/gr.1006603; Maheshri N, 2007, ANNU REV BIOPH BIOM, V36, P413, DOI 10.1146/annurev.biophys.36.040306.132705; Malone CD, 2009, CELL, V136, P656, DOI 10.1016/j.cell.2009.01.045; Mante C, 2008, ACTA BIOTHEOR, V56, P1, DOI 10.1007/s10441-008-9027-z; Martin KC, 2009, CELL, V136, P719, DOI 10.1016/j.cell.2009.01.044; Mehta T, 2004, NAT GENET, V36, P943, DOI 10.1038/ng1422; Mestdagh P, 2009, GENOME BIOL, V10, DOI 10.1186/gb-2009-10-6-r64; Meyer KB, 2008, PLOS BIOL, V6, P1098, DOI 10.1371/journal.pbio.0060108; Miura M, 2003, ANTICANCER RES, V23, P1271; Moonesinghe R, 2007, PLOS MED, V4, P218, DOI 10.1371/journal.pmed.0040028; Moore MJ, 2009, CELL, V136, P688, DOI 10.1016/j.cell.2009.02.001; Muller PY, 2002, BIOTECHNIQUES, V32, P1372; Murphy B Jamie, 2007, Expert Opin Med Diagn, V1, P31, DOI 10.1517/17530059.1.1.31; Murphy J, 2009, EXPERT REV MOL DIAGN, V9, P187, DOI 10.1586/14737159.9.2.187; Nolan T, 2006, ANAL BIOCHEM, V351, P308, DOI 10.1016/j.ab.2006.01.051; Nolan T, 2006, NAT PROTOC, V1, P1559, DOI 10.1038/nprot.2006.236; Ozsolak F, 2009, NATURE, V461, P814, DOI 10.1038/nature08390; Pang XL, 2009, AM J TRANSPLANT, V9, P258, DOI 10.1111/j.1600-6143.2008.02513.x; Paroo Z, 2009, CELL, V139, P112, DOI 10.1016/j.cell.2009.06.044; Pattyn F, 2003, NUCLEIC ACIDS RES, V31, P122, DOI 10.1093/nar/gkg011; Pattyn F, 2006, NUCLEIC ACIDS RES, V34, pD684, DOI 10.1093/nar/gkj155; Peixoto A, 2004, GENOME RES, V14, P1938, DOI 10.1101/gr.2890204; Perez-Novo CA, 2005, BIOTECHNIQUES, V39, P52; Pfaffl MW, 2001, BIOTECHNOL LETT, V23, P275, DOI 10.1023/A:1005658330108; Pfaffl MW, 2001, NUCLEIC ACIDS RES, V29, DOI 10.1093/nar/29.9.e45; Plum L, 2009, NAT MED, V15, P1195, DOI 10.1038/nm.2026; Ponting CP, 2009, CELL, V136, P629, DOI 10.1016/j.cell.2009.02.006; Port M, 2007, DIAGN MOL PATHOL, V16, P38, DOI 10.1097/01.pdm.0000213472.70054.94; Preiksaitis JK, 2009, AM J TRANSPLANT, V9, P269, DOI 10.1111/j.1600-6143.2008.02514.x; Raj A, 2006, PLOS BIOL, V4, P1707, DOI 10.1371/journal.pbio.0040309; Ramakers C, 2003, NEUROSCI LETT, V339, P62, DOI 10.1016/S0304-3940(02)01423-4; Raser JM, 2005, SCIENCE, V309, P2010, DOI 10.1126/science.1105891; Rieu I, 2009, PLANT CELL, V21, P1031, DOI 10.1105/tpc.109.066001; Ritz C, 2008, BIOINFORMATICS, V24, P1549, DOI 10.1093/bioinformatics/btn227; Rutledge RG, 2004, NUCLEIC ACIDS RES, V32, DOI 10.1093/nar/gnh177; Rutledge RG, 2003, NUCLEIC ACIDS RES, V31, DOI 10.1093/nar/gng093; Rutledge RG, 2008, BMC BIOTECHNOL, V8, DOI 10.1186/1472-6750-8-47; Schmittgen TD, 2008, NAT PROTOC, V3, P1101, DOI 10.1038/nprot.2008.73; Schuster R, 2004, INT J CANCER, V108, P219, DOI 10.1002/ijc.11547; Shen LL, 2005, JNCI-J NATL CANCER I, V97, P1330, DOI 10.1093/jnci/dji275; Simon R, 2002, GENET EPIDEMIOL, V23, P21, DOI 10.1002/gepi.202; Sindelka R, 2008, NUCLEIC ACIDS RES, V36, P387, DOI 10.1093/nar/gkm1024; Springer NM, 2007, PLANT CELL, V19, P2391, DOI 10.1105/tpc.107.052258; Stahlberg A, 2004, CLIN CHEM, V50, P1678, DOI 10.1373/clinchem.2004.035469; Stahlberg A, 2004, CLIN CHEM, V50, P509, DOI 10.1373/clinchem.2003.026161; Tichopad A, 2004, MOL CELL PROBE, V18, P45, DOI 10.1016/j.mcp.2003.09.001; Tichopad A, 2003, NUCLEIC ACIDS RES, V31, DOI 10.1093/nar/gng122; Tichopad A, 2009, CLIN CHEM, V55, P1816, DOI 10.1373/clinchem.2009.126201; Tononi G, 1999, P NATL ACAD SCI USA, V96, P3257, DOI 10.1073/pnas.96.6.3257; Udvardi MK, 2008, PLANT CELL, V20, P1736, DOI 10.1105/tpc.108.061143; Uhlmann V, 2002, J CLIN PATHOL-MOL PA, V55, P84, DOI 10.1136/mp.55.2.84; Vandesompele J, 2002, GENOME BIOL, V3, DOI 10.1186/gb-2002-3-7-research0034; Vermeulen J, 2009, NUCLEIC ACIDS RES, V37, DOI 10.1093/nar/gkp721; Vlems FA, 2003, EUR J CANCER, V39, P388, DOI 10.1016/S0959-8049(02)00631-7; Wahl MC, 2009, CELL, V136, P701, DOI 10.1016/j.cell.2009.02.009; Wilkinson DJ, 2009, NAT REV GENET, V10, P122, DOI 10.1038/nrg2509; Wong IHN, 2001, CANCER LETT, V162, P65, DOI 10.1016/S0304-3835(00)00630-3; Yuan Joshua S., 2008, Biotechnology Journal, V3, P112, DOI 10.1002/biot.200700169; Yuan JS, 2006, BMC BIOINFORMATICS, V7, DOI 10.1186/1471-2105-7-85 120 209 212 2 98 ACADEMIC PRESS INC ELSEVIER SCIENCE SAN DIEGO 525 B ST, STE 1900, SAN DIEGO, CA 92101-4495 USA 1046-2023 1095-9130 METHODS Methods APR 2010 50 4 217 226 10.1016/j.ymeth.2009.12.006 10 Biochemical Research Methods; Biochemistry & Molecular Biology Biochemistry & Molecular Biology 577ZH WOS:000276262100002 20025972 2020-04-01
0.0000 0 0 回复

推荐课程

推荐帖子