Utilisez Python pour proposer l'année de la colonne de date dans les deux CSV, faire une nouvelle colonne, puis combiner les deux tableaux CSV en un seul tableau avec la colonne de date et le numéro d'identification.

Questions et réponses du rseoc 2021-11-25 10:05:18
utilisez python pour proposer ann

J'ai essayé d'en mettre deux.csvDate dans la colonne année de présentation,Faire une nouvelle colonne,Deux de plus.csvTableau par nouvelle date colonne etIDNo. To Merge into a table.
Première étape,Montre.1Et tableaux2DeUSERDATEAnnée moyenne,Faire une nouvelle colonne,USERDAE_YEAR

Tableau1 ADSXLIST
Phase ID RID SITEID VISCODE VISCODE2 USERDATE
ADNI1 2 2 107 m06 m06 2006/3/7
ADNI1 4930 2 107 m36 m36 2008/8/29
..... ......
ADNI1 4 5 107 m06 m06 2006/3/9
ADNI1 196 5 107 m12 m12 2006/9/6
Tableau2 summary
Phase ID RID PTID SITEID VISCODE VISCODE2 USERDATE USERDATE2 EXAMDATE
ADNI1 2 2 011_S_0002 107 bl bl 2005/10/1 2005/9/29
ADNI1 336 2 011_S_0002 107 m06 m06 2006/4/27 2006/3/6
...
ADNI1 3136 4 022_S_0004 10 m18 m18 2007/6/22 2007/5/14
ADNI1 6060 4 022_S_0004 10 m36 m36 2008/12/1 2008/11/18

Et en mettre deux autrescsvDans le tableau,RIDEtUSERDAE_YEARMême section,Former un nouveaucsvTableau.

Codes liés au problème,Ne collez pas la capture d'écran

import pandas as pdimport osos.chdir(r'D:\BaiduNetdiskDownload\ADNI database\Diagnosis')file1=pd.read_csv(r'ADSXLIST.csv')file1['USERDAE_YEAR']=file1['USERDATE'].split(‘/’,1)[0]print(file1['USERDAE_YEAR'])
Résultats de l'opération et contenu du rapport d'erreur

0 0 2006
1 0 2006

 ... 

4883 0 2006

C'est une erreur. .

版权声明
本文为[Questions et réponses du rseoc]所创,转载请带上原文链接,感谢
https://pythonmana.com/2021/11/20211120205321237r.html

  1. Python regular expression select Characters
  2. Object oriented composition of Python
  3. Python Software Development Directory
  4. Python package
  5. Python module
  6. Python is process oriented and functional
  7. Python generator
  8. Python iterator
  9. Python decorator
  10. Python function closure
  11. Python namespace and scope
  12. Python function
  13. Python file processing
  14. Python data type
  15. Process control of Python
  16. Garbage collection mechanism of Python
  17. Python: the field notes of dtype = 'object' can also be arranged in ascending and descending order
  18. . value in pandas_ Usage of counts()
  19. 202111 | some hands-on practice of Python time function
  20. 202111 | in Python, timestamp, time string and real date time are converted to each other
  21. Pandas draws line chart, bar chart and bar chart
  22. Exploration and practice of easy transformation between various data structures in Python
  23. A simple practice of Python list generation
  24. Use Python to guess the number of machines and judge the number of guesses
  25. Question about Python: did you learn Python
  26. 20210928 | Python case: building tax calculation function
  27. Python basic syntax collation
  28. Some small accumulation of writing programs in python (4)
  29. Some small accumulation of writing programs in python (3)
  30. Python leak detection tips (3)
  31. Python leak detection tips (2)
  32. Python leak detection tips (1)
  33. Python foundation and MySQL Foundation
  34. Some small accumulation of writing programs in python (2)
  35. Some small accumulation of writing programs in Python
  36. Python 3.7.3 + cuda9.2 installing Python
  37. Python knowledge used to write programs
  38. Python installation + vscode configuration Python environment
  39. Some small problems during Python installation
  40. Answer and Q & A of Python practice introduction course
  41. Sorting out the learning route for Python beginners
  42. The 6-line Python code uses the pdf2docx module converter object to convert PDF into docx file
  43. Batch compression of picture files using Python
  44. Using Python to write djikstra algorithm for robot path planning
  45. python实现手机号获取短信验证码 | 对接打码平台
  46. Detailed explanation of Euler Rodriguez code in Python
  47. Prove that angular displacement is not a vector with Python
  48. Using Python program to deeply understand homogeneous transfer matrix t
  49. Triple product formula of vector and its proof (with Python code)
  50. Derivation of differential formula of DH matrix using Python
  51. Python openpyxl operation on Excel (get the total number of columns, get the value of a row, get the value of a column, and set the cell value)
  52. Realizing Excel data filtering and data matching with Python
  53. Python reads and writes files
  54. Four scenarios of processing Excel files with Python
  55. Python converts dictionary to excel
  56. Python implements file reading and writing
  57. Basic Python syntax -- functions
  58. Python learning thinking
  59. Basic Python syntax -- lists, dictionaries
  60. Python basic syntax -- conditional judgment, input ()