bishopscott - bishop scott boys school
TRANSCRIPT
BISHOPSCOTTBOYS’SCHOOL(AffiliatedtoCBSE,NewDelhi)AffiliationNo.:330726,SchoolCampus:Chainpur,Jaganpura,By-Pass,Patna804453.PhoneNumber:7061717782,9798903550.,Web:www.bishopscottboysschool.com Email:[email protected]
ONLINESTUDYMATERIALSUBJECT-ENGLISH
SESSION-2021-22
CLASS-XII
CHAPTER:41.TheRattrap[FLAMINGO]
DAY-1
STUDYMATERIAL
Chapter4:TheRattrapBy:SelmaLagerlof
AbouttheauthorSelmaLagerlof(1858-1940)wasaSwedishwriterwhosestorieshavebeentranslatedintomanylanguages.Thisstoryissetinthemiddleof theminesofSwedenwhicharerichinironore.Thestoryisnarratedinthemannerofafairytale.Itgivesusthemessagethattheemotionsofloveandacceptancecanreform others.
TheRattrapSummaryTheRattrapisastoryaboutarattrapsellerwholeadsaverypoorlifeashisearningsareverylow.Hehastoresorttothieveryandbeggingtomakebothendsmeet.
Heisaloneinthiswholeworldandleadsamiserablelife.Sohestartsknittingupvariouskindsofthoughts.Oneofthesethoughtsisofsupposingthewholeworldasabigrattrap.Hisviewsarethattheworldoffersusvarioustypesofbaitsintheform ofcomfortsoflife.Thisinreturntrapsusintotherattrapoftheworldandleadsustovarioustypesofmiseries.
Everynight,thepeddlerhadtosearchforshelterashehasnohome.Oneeveninghewasofferedshelterbyanoldcrofter.Thenextmorninghestolethecrofter’smoneywhichhehadearnedbysellinghiscow’smilk.Tosafeguardhimself,thepeddlerchosethepaththroughtheforestwhichwassecluded,butsoonfoundhimselftrappedintheforestashewasn’tabletofindthewayoutofthedenseforest.Lateron,hefindsawayto a forge and takes shelterthere.Something unusualhappens.The ironmaster
mistakeshim asanoldfriendandinviteshim tohishouse.Thepoorpeddlerrejectstheofferduetothefearofbeingcaught.Soonheisinvitedbytheironmaster‘sdaughter.Thenextmorningheissomehow stoppedbytheironmaster’sdaughterforChristmasEveevenafterbeingcaughtthathewasapeddlerandnotCaptainStalhe.
ThenextdayafterChristmas,whentheironmasterandhisdaughtervisitthechurch,theycometoknowthatthemanisathiefwhohadstolenmoneyfrom theoldcrofter.Theironmasterandhisdaughterrepentforshelteringathiefandwonderatwhatallthingshewouldhavestolenbythattime.Herecomesatwistasinsteadofstealing,thepeddlergiftstheironmaster’sdaughterarattrap.Shefindsaletterofthanksandthestolenmoneyinsidetherattrap.ThepeddlerthanksEdlaforherkindnessandrequestshertoreturnthestolenmoneytothecrofter. Thisstorygivesusthemessagethatgoodnessinahumanbeingcanbeawakenedatanytimewithyourowngooddeeds.
DAY-2
Themeofthestory
Thethemeofthestoryisthatmost human beingsarepronetofallintothetrap of material benefit. However,every human being has an essentialgoodness that can be awakened through understanding and love.A human beinghasthetendencytoredeem himselffrom dishonestways.
Messageofthestory
The rattrap peddlerisapoorman.Herobsthesamewhogiveshim shelterandfood.ButheisreformedbythecompassionatebehaviourofayounggirlEdla.This story givesthe message thattheessentialgoodnessofmancanbeawakenedthroughloveandunderstanding.
The metaphor ofthe rattrap
The metaphor ofthe rattrapsignifies thattheworldexistsonlytotrappeoplebysettingbaitsforthem.Wheneversomeone is temptedbytheluxuries,heendsupbeingcaughtinadangeroustrap.
VIDEO-LINK
Link: https://www.youtube.com/watch?v=QFObwSI2hvw
DAY-3
PLOTOVERVIEW
Throughthestory‘TheRattrap’theauthorunderlinesthebeliefsthatessentialgoodnessinhumanbeingscanbearousedthroughsympathy,understandingandlove.Thestoryrevolvesaroundamanwhousedtosellrattraps,stealsandevenbegstomakehisendsmeet.Whilewalkinghewasstruckwithasuddenrealizationthatthewholeworldisarattrapanditoffersrichesasbaits.
Justlikearatistemptedtotouchandtakethebaitawayevenpeoplearetemptedtotouchthebaitprovidedbytheworldassoonastheygetcloserittrapsthem bringingeverythingattheend.Onedarkeveningrattrappeddlersoughtashelterinanoldcrofter’sroadsidecottage.
Theoldmanwaskind-heartedandgenerousandgavehim food,tobaccoandevenplayedacardgamewithhim.Theoldmantoldhim abouthisearningsandalsotoldhim wherehekeptthem.Thenextmorningthepeddlerstoleawaytheoldman’searningsthatwerethirtykroner.Heescapedintoabigconfusingforestandgotlost.Hegottiredandjustwhenhewasabouttoconcludethathisendisnearheheardthethumpingvoicesfrom theRamsjoironworksandhewentinsidetoseekshelterforthe night.The ownersoon came and noticed him andmistakenhim foranoldacquaintanceofhisnamedNilsOlof.
Heinvitedthepeddlertostaywithhim fortheChristmasEveasevenheandhisdaughterwereunhappyspendingtheeveallalone.ThoughthepeddlerwasreluctantwhentheownerofthemillsenthisdaughterEdlaWillmanssontopersuadehim hecouldnotsayno.Thepeddlerrealizesthatbystealingthirtykronorfrom theoldmanandacceptingtheinvitationforChristmasEvehehasknowinglythrownhimselfintothelion’sden.Whenthepeddlercametothedining tablkeallwell-groomed and dressed notasa tramp butasagentlemantheironmasterortheownerrealizersthathehadmistakenhim andhethreatenedtocallthesheriff.
Thoughhisdaughterpleadedthatthepeddlershouldnotbebotheredandhedeservesatleastonedayatpeace.Theironmasteralthough reluctantlyagreedtohisdaughter’srequestandthepeddlerwasgivenfoodandplacetosleepandwasnotdisturbedexceptforfood.Nextmorningtheironmasterandhisdaughterlearnatthechurchaboutthemanwhostolethirtykronorfromtheoldmanandescapedintothewoodsandtheyrealizeit’snoneotherthantheguestandtheyrushhomeonlytofindthatthemanwasgone.
ButhedidnotstealanythinginsteadheleftapacketforEdlaasherChristmaspresent,sheopensthepacketandfindsarattrap,threewrinkledten-kronornotesandalsoaletterwitharequesttoreturnthekronortothecrofter.
DAY-4
CHARACTERSKETCH:
PeddlerorTheRattraporCaptainVonStahle:
1.Thepeddlerwasapoorvagabond.2.Hesoldrattrapstoearnhislivingsorkeephisbodyandsoultogether.3.Healsoresortedtothieverywhenrequired.4.Hewasstruckwithadarkrealizationthattheworlditselfisarattrap
andallmenandwomenarejustlikeratsthatarevulnerabletobetrappedtovarioustypesofbaits.
5.Hewasinherentlynotabadperson.Hehadsomegoodnessinhim thatwasirkedbyEdla,theironmaster’selderdaughter.
EdlaWilmannsson:
1.Shewastheoldestdaughteroftheironmaster.2.Shewasnotatllprettybutseemedmodest,quietshy.3.Kind-hearted.4.Compassionate.5.Smartenoughtounderstandrightlyfrom thepeddler’seyesthathe
mighthaveescapedfrom jailorstolensomething.6.Shewasagreathumanbeing.
Croftor:
1.Hewaslonelyandhadnobodytotalkto.2.Hewashappytoseethepeddlerandgavehim shelter.Thisgesture
madetherpeddlerfeelwelcomedandcomfortablebecausehewasusedtoseeingsourandunwelcomedfacesordinarily.
3.Hewasgenerous.4.HehadbeenacrofteratRamsjoIronworks.5.Trustedthestrangereasilywithhisconfidaences.
Tom AnTheIronmaster(Ironworksowner):
1.Theironmasterwastheownerofthelargeironfactory,Ramsjo
Irinworks.2.Hisgreatestambitionwastoshipoutgoodironinthemarket.3.Hard-workingandconsciousofhisdutiesasheusedtogototheforge
fornightlyinspections.
DAY-5
TheRattrap-QuestionandAnswersQ1-Howdoesthepeddlerinterprettheactsofkindnessandhospitalityshownbythecrofter,theironmasterandhisdaughter?
A1-Thepeddlerwasarattrapseller.Hewasleadingalifeofmisery.Hewashomeless.Moreover,hedidn’thaveenoughmoneytosurvive.So,hehadtodependuponbeggingandthievery.Hewasonceofferedshelterbyanoldcrofter.Hewantedcompanyandshowedkindnesstowardsthepeddlerbysharinghisporridgeandtobacco.Inreturn,thepeddlerbetrayedhim andstolehismoney.
Theironmastermistookhim ashisoldcompanionCaptainVonStahle;heshowedhiskindnesstohim andinvitedhim tohishouseforChristmasEve.Thepeddlerknewthattheironmasterwasmakingamistakebythinkinghim tobehisoldfriendbutherealsohedidnotcleartheairandsimplyacceptedtheinvitation.Hedidthissothattheironmastermaygivehim somemoneyoutofpity.
EldaWilliamsonwhowastheironmaster’sdaughterinvitedhim totheirhouseinaveryfriendlyway.Also,sheinsistedherfathertolethim stayforChristmasEveevenafteritwasrevealedthathewasnotCaptainVonStahle.ThekindnatureofEldachangedthepeddlerandhenotonlythankedherbygiftingarattrapforbeingsokindandcaringbutalsorequestedhertoreturnthestolenmoneytotheoldcrofter.
Q2-Whataretheinstancesinthestorythatshowthatthecharacteroftheironmasterisdifferentfrom thatofhisdaughterinmanyways?
A2-Thecharacterofbothironmasterandhisdaughterweretotallydifferentfrom eachother.Theironmasterwasaproudman.Whenhesawthepeddler,hemistookhim asanoldregimentalcomradeandtriedtohelphim outofhissenseofpride.Whenherealizedthathehadbeenmistaken,hecalledthepeddlertobedishonestandalsowarnedhimofcallingthesheriff.Notonlythis,heworriedabouthissilverspoonswhenhecomestoknowthatpeddlerwasathief.Ontheotherhand,theironmaster’sdaughterwasakindlady,whoreallywantedtohelpthepeddler.Shetreatedhim withrespectanditwasherkindnaturewhichchangedthepeddlerandmadehim agoodperson.
Q3-Thestoryhasmanyinstancesofunexpectedreactionsfrom thecharacterstoothers’behaviour.Pickoutinstancesofthesesurprises?
A3-Thestoryhasmanyinstancesofunexpectedreactionsfrom thecharactersto
others’behavior.Forexample:Oneeveningwhenthepeddlerknockedatthedoorofalittlehut,hewasnotdisappointedbytheownerratherhewelcomedhim andtriedtobeagoodhosttohimbyofferinghim foodandplayingcardswithhim.Inanotherinstancewhenthepeddlerwentinsideaforgetoseekshelter,therehewasinvitedbytheironmastertohishouseashemistookhim asoneofhisoldregimental comrade.Butwhentheironmasterrealizedthathehadinvitedsomeunknownpersontohishouse,heaskedhim toleave.Athistime,hewasallowedtostaybyhisdaughterEldaoutofkindness.
Q4-Whatmadethepeddlerfinallychangehisways?
A4-EdlaWillimansson’skindnessreformedthepeddler.Herkindness,compassionandgenerositykilledthethiefinhim.Hegiftedherarattrap.Also,hereturnedthethreetenkronornotesthathehadstolenfrom thecrofter’shouse.Herequestedhertoreturnthemoneytotheoldcrofter.Hewrotealettertoher,thankingherfortreatinghim welljustlikeshewouldhavetreatedarealcaptain.
Q5-Howdoesthemetaphoroftherattrapservetohighlightthehumanpredicament?
A5- Theworldtemptsthehumanbeingsbyvariousgoodthingssuchastheluxuriesandjoys,foodandshelter,clothingandwarmth,etc.Theyarejustlikethebaitwhichisplantedtotrapsomeoneintherattrapoftheworld.Inthestorythepeddlerwasattractedtothethreetenkronorsofthecrofter,whichhestolefrom him.Lateron,hefoundhimselftrappedintheforestasheplannedtohidehimselfbywalkingthroughthewoods.Whenhegottrapped,hethoughtthatthiswasapunishmentforhissinof gettingluredbythemoney.
Q6-Thepeddlercomesoutasapersonwithasubtlesenseofhumour.Howdoesthisserveinlighteningtheseriousnessofthethemeofthestoryandalsoendearhim tous?
A6-Wecanseethepeddler’ssenseofhumourwhenhecomparestheworldwitharattrap.Wheneverhegetscaughtduetohisownknittedstories,hetriestoprovehisinnocencebybelievingthathehasfallenintothetrapofthisworldwhichactuallyislikearattrap.Thislightenstheseriousnessofthestoryandmakesthereadersympathizewithhim.
Page 1 of 17
BISHOP SCOTT BOYS’ SCHOOL (Affiliated to CBSE, New Delhi) Affiliation No.: 330726, School Campus: Chainpur, Jaganpura,
By-Pass, Patna 804453.
Phone Number: 7061717782, 9798903550. , Web: www.bishopscottboysschool.com Email: [email protected]
STUDY COURSE MATERIAL
PHYSICS SESSION-2021-22
CLASS-Xll
TOPIC: CH-09 : RAY OPTICS
DAY-1
Page 1 of 11
BISHOP SCOTT BOYS’ SCHOOL (Affiliated to CBSE, New Delhi) Affiliation No.: 330726, School Campus: Chainpur, Jaganpura,
By-Pass, Patna 804453.
Phone Number: 7061717782, 9798903550. , Web: www.bishopscottboysschool.com Email: [email protected]
STUDY COURSE MATERIAL
Chemistry SESSION-2021-22
CLASS-12
TOPIC: ALDEHYDES KETONES & CARBOXYLIC ACID
TEACHING MATERIAL
Aldehydes: Aldehydes are the organic compounds in which carbonyl group is attached to
one hydrogen atom and one alkyl or aryl group.
Where R can be an alkyl or aryl group
Preparation of aldehydes:
a) By oxidation of alcohols: Oxidation of primary alcohols in presence of oxidizing agent like
K2Cr2O7/H2SO4, KMnO4,CrO3 gives aldehydes.
b) By dehydrogenation of alcohols: When the vapours of primary alcohol passed through
heated copper at 573 K, it forms aldehyde.
d) By Rosenmund reduction: Hydrogenation of acyl chloride over palladium on barium
sulphate gives aldehyde.
e) By reduction of nitriles:
i) Stephen Reaction: Reduction of nitriles in presence of stannous chloride in presence of
HCl gives imine which on hydrolysis gives corresponding aldehyde.
Page 2 of 11
c) By hydration of alkynes: Ethyne on hydration with at 333 K forms
acetaldehyde.
d) From acyl chloride: Acyl chloride on treatment with dialkyl cadmium (prepared by
reaction of cadmium chloride with Grignard reagent) gives ketone.
e) From nitriles: Nitriles on treatment with Grignard reagent followed by hydrolysis give ketones.
f) By Friedel Crafts acylation reaction: Benzene or substituted benzene on treatment with acid
chloride in presence of anhydrous aluminium chloride forms ketone.
g) Preparation of aldehydes and ketones by ozonolysis of alkenes:
Page 3 of 11
Reactions of aldehydes and ketones:
1. Aldehydes are generally more reactive than ketones in nucleophilic addition
reactions due to steric and electronic reasons (or inductive effect).
2. Electronic Effect: Relative reactivities of aldehydes and ketones in nucleophilic
addition reactions is due the positive charge on carbonyl carbon. Greater positive
charge means greater reactivity. Electron releasing power of two alkyl groups in
ketones is more than one in aldehyde. Therefore positive charge is reduced in
ketones as compared to aldehydes. Thus ketones are less reactive than aldehydes.
3. Stearic Effect: As the number and size of alkyl group increase, the hindrance to the
attack of nucleophile also increases and reactivity decreases. In aldehydes there is
one alkyl group and one hydrogen atom, whereas in ketones there are two alkyl
groups (same or different).
Nucleophilic addition reactions of aldehydes and ketones:
(a) Addition of hydrogen cyanide (HCN) to form cyanohydrins
(b) Addition of sodium hydrogensulphite to form bisulphate addition compound
(c) Addition of Grignard reagent (RMgX) to form alcohol
(d) Addition of alcohol:
(i) Aldehydes on addition of monohydric alcohol in presence of dry HCl forms hemiacetal and
acetal.
Page 4 of 11
(ii) Ketones do not react with monohydric alcohols. Ketones react with ethylene glycol under
similar conditions to form cyclic products known as ethylene glycol ketals.
(e) Addition of ammonia and its derivatives:
Reduction of aldehydes and ketones:
(a) Reduction to alcohols:
Aldehydes and ketones on catalytic hydrogenation in presence of Ni, Pt or Pd by using lithium
aluminium hydride or sodium borohydride forms primary and secondary
alcohols respectively.
(b) Reduction to hydrocarbons:
(i) Clemmensen reduction: Carbonyl group of aldehydes and ketones is reduced to group on
treatment with zinc amalgam and concentrated hydrochloric acid.
(ii) Wolff-Kishner reduction: Carbonyl group of aldehydes and ketones is reduced to group
on treatment with hydrazine followed by heating with sodium or potassium hydroxide in high
boiling solvent such as ethylene glycol.
(iii)
Oxidation of aldehydes and ketones:
(i) Aldehydes are oxidized to acids in presence of mild oxidising agents HNO3, K2Cr2O7, KMnO4.
Page 5 of 11
(ii) Ketones are oxidized under drastic conditions i.e. with powerful oxidising agents
like at higher temperature.
In case of unsymmetrical ketones cleavage occurs in such a way that keto group stays with smaller
alkyl group. This is known as Popoff’s rule.
(iii)Haloform reaction: Aldehydes and ketones having at least one methyl group linked to the
carbonyl carbon atom i.e. methyl ketones are oxidised by sodium hypohalite to sodium salts of
corresponding carboxylic acids having one carbon atom less than that of carbonyl compound. The
methyl group is converted to haloform.
Reactions of aldehydes and ketones due to -hydrogen:
(i) Aldol condensation: Aldehydes and ketones having at least one -hydrogen undergo a self
condensation in the presence of dilute alkali as catalyst to form -hydroxy aldehydes (aldol) or -
hydroxy ketones (ketol), respectively.
Page 6 of 11
(ii) Cross aldol condensation: Aldol condensation between two different aldehydes and ketones is
called aldol condensation. If both of them contain -hydrogen atoms, it gives a mixture of four
products.
Canizzaro reaction: Aldehydes which do not have an -hydrogen atom undergo
self-oxidation and reduction (disproportionation) reaction on treatment with
concentrated alkali to form alcohol and salt of acid.
Page 7 of 11
Test to distinguish aldehydes and ketones:
1. Tollen’s test: When an aldehyde is heated with Tollen’s reagent it forms silver mirror.
Tollen’s reagent is ammoniacal solution of
Ketones do not form silver mirror and hence do not give this test.
2. Fehling’s test: When an aldehyde is heated with Fehling’s reagent it formsreddish
brown precipitates of cuprous oxide.Fehling’s reagent: Fehling solution A (aqueous
solution of ) + Fehling solution B (alkaline solution of sodium potassium
tartarate)
Ketones do not give this test.
Carboxylic Acids:Carboxylic acids are the compounds containing the
carboxylfunctional group (-COOH).
Preparation of carboxylic acid:
(i) From alcohols: Primary alcohols are readily oxidised to carboxylic acids with common oxidising
agents such as potassium permanganate in neutral, acidic or alkaline media or by
potassium dichromate (K2Cr2O7) and chromium trioxide in acidic media.
a)
b)
(ii) From aldehydes: Oxidation of aldehydes in presence of mild oxidizing agents like Tollen’s
reagent (ammoniacal solution of ) or Fehling reagent (Fehling solution A (aqueous solution
of ) + Fehling solution B (aqueous solution of sodium potassium tartarate)) forms
carboxylic acids.
1. 2.
(iii) From alkylbenzenes: Aromatic carboxylic acids can be prepared by vigorous oxidation of alkyl
benzenes with chromic acid or acidic or alkaline potassium permanganate.
Page 8 of 11
(iv) From alkenes: Suitably substituted alkenes are oxidised to carboxylic acids on oxidation with
acidic potassium permanganate or acidic potassium dichromate.
1.
2. (v) From Nitriles: Nitriles on hydrolysis in presence of dilute acids or bases forms amide which on
further hydrolysis gives carboxylic acid.
(vi) From Grignard reagent: Grignard reagents react with carbon dioxide (dry ice) to form salts of
carboxylic acids which on hydrolysis forms carboxylic acids.
(vii) From acyl halides and anhydrides: Acid chlorides when hydrolysed with water give carboxylic
acids .On basic hydrolysis carboxylate ions are formed which on further acidification forms
corresponding carboxylic acids. Anhydrides on hydrolysis forms corresponding acid(s)
(viii) From esters: Acidic hydrolysis of esters gives directly carboxylic acids while basic hydrolysis
gives carboxylates, which on acidification give corresponding carboxylic acids.
Physical properties of carboxylic acids:
(i) Solubility: As the size of alky group increases solubility of carboxylic acid decreases because
non-polar part of the acid increases
(ii) Boiling points: Carboxylic acids are higher boiling liquids than aldehydes, ketones and even
alcohols of comparable molecular masses. This is due to extensive association of carboxylic acid
molecules through intermolecular hydrogen bonding.
Page 9 of 11
Acidity of carboxylic acids:
Carboxylic acids are more acidic than phenols. The strength of acid depends on extent of
ionization which in turn depends on stability of anion formed.
(i) Effect of electron donating substituents on the acidity of carboxylic acids: Electron donating
substituent decreases stability of carboxylate ion by intensifying the negative charge and hence
decreases acidity of carboxylic acids.
(ii) Effect of electron withdrawing substituent on the acidity of carboxylic acids: Electron
withdrawing group increases the stability of carboxylate ion by delocalizing negative charge and
hence, increases acidity of carboxylic acid. The effect of the following groups in increasing acidity
order is Ph< I < Br <cl< f=””>2 < CF3</cl<>
(a) Effect of number of electron withdrawing groups: As the number of electron withdrawing
groups increases –I effect increases, increasing the acid strength
(b) Effect of position of electron withdrawing group: As the distance between electron withdrawing
group and carboxylic group increases, electron withdrawing influence decreases.
Reaction of carboxylic acids:
Reactions involving cleavage of C-OH bond:
Carboxylic acids on heating with mineral acids such as or with give corresponding
anhydride.
(i) Anhydride formation:
(ii) Esterification: Carboxylic acids are esterified with alcohols in the presence of a mineral acid
such as concentrated or HCl gas as a catalyst.
(iii) Carboxylic acids react with PCl5, PCl3 and SOCl2 to form acyl chlorides.
1. 2. 3.
(iv) Reaction with ammonia (NH3): Carboxylic acids react with ammonia to give ammonium salt
which on further heating at high temperature gives amides.
i)
Page 10 of 11
ii)
Reactions involving COOH group:
(i) Reduction: Carboxylic acids are reduced to alcohols in presence of LiAlH4 or B2H6.
(ii) Decarboxylation : Sodium or potassium salts of carboxylic acids on heating with soda lime
(NaOH + CaO in ratio of 3:1) gives hydrocarbons which contain one carbon less than the parent
acid.
(c) Reactions involving substitution reaction in hydrocarbon part:
(i) Hell-Volhard-Zelinsky reaction: Carboxylic acids having an -hydrogen are halogenated at the
-position on treatment with chlorine or bromine in the presence of small amount of red
phosphorus to give -halocarboxylic acids)
(ii) Ring substitution in aromatic acids: Aromatic carboxylic acids undergo electrophilic substitution
reactions. Carboxyl group in benzoic acid is electron withdrawing group and is meta directing.
i)
ii)
BISHOP SCOTT BOYS’ SCHOOL (Affiliated to CBSE, New Delhi) Affiliation No.: 330726, School Campus: Chainpur, Jaganpura, By-Pass, Patna 804453. Phone Number: 7061717782, 9798903550. , Web: www.bishopscottboysschool.comEmail: [email protected]
STUDY COURSE MATERIAL
BIOLOGY SESSION-2021-22
CLASS - 12
TOPIC: PRINCIPLES OF INHERITANCE AND VARIATION
DAY-1
TEACHINGMATERIAL
POINTS TO REMEMBER
Heredity - Heredity is a process of transmission of heritable traits from parents to their offsprings.
Genetics - Genetics is the branch of biology dealing with the principles and mechanism of inheritance and variation.
Inheritance - Inheritance is the basis of heredity and by this process, traits are passed on from the parents to the offsprings. Continuity of the gene pool is maintained by the process of inheritance.
Genes - Genes are the basic unit of inheritance and located on chromosomes.
Variation - Variation exists among individuals of one species. Variation is due to crossing over, recombination, mutation and environmental effects on the expression of genes present on chromosomes.
NCERT LINK:https://www.learncbse.in/principles-inheritance-
variation-cbse-notes-class-12-biology/
Video links: https://youtu.be/uqtpBRLvOYA
Page 1of 6
DAY-2
TEACHINGMATERIAL
Mend el’s L aws of Inheritance
Gregor Johann Mendel is called “Father of genetics”.
Mendel performed experiments on Garden pea. He took 14 true-breeding plants of pea having seven distinguishable characters, which have two opposite traits.
He called genes as “factors”, which are passed from parents to
offsprings.
Genes, that code for a pair of opposite traits are called “alleles”.
He gave three laws of inheritance based on his observation:
Page 2of 6
Law of Dominance: One of the alleles is dominant and gets expressed in the phenotype in
case of the heterozygote, e.g. When we cross homozygous tall (TT) and dwarf (tt) plants, in the off springs we get all the tall plants having the genotype Tt, so tallness is a dominant trait over dwarfness.
Law of Segregation of genes:
Page 3of 6
Each allele separates during meiosis at the time of gamete formation. There is no blending and characters are passed to different gametes. Homozygotes produce only one kind of gametes and heterozygotes produce different kinds of gametes.
Law of Independent assortment: It states that alleles for different traits are inherited independently. He showed that
using a dihybrid cross.
Test Cross: It is to find out the genotype of the plant showing dominant trait, the
given plant is crossed with the recessive homozygote. The two observations are:
o If the phenotype of offsprings show only the dominant trait, then the parent plant was homozygote to the dominant trait
o If the offsprings produced are of both phenotypes, then the parent plant Page 4of 6
was heterozygote to the dominant trait.
NCERT LINK:https://www.learncbse.in/principles-inheritance-
variation-cbse-notes-class-12-biology/
Video links: https://youtu.be/bDygVQzCFLM
https://youtu.be/c6s_Imomolk
https://youtu.be/NQD4al7YZOM
DAY-3
Incomplete Dominance
When neither of the two alleles is dominant and the phenotype of the heterozygote does not resemble any of the parents. The heterozygote expresses intermediate or a mixture of two parents’ traits.
Example: The flower colour inheritance of snapdragon (dog flower). On
Page 5of 6
crossing true breeding red (RR) and white flower (rr), we get all pink colour flowers in the F1 generation, which on self-pollination give red: pink: white flowers in the ratio 1:2:1 in the F2 generation.
Page 6of 6
Co-dominance
When both the alleles express themselves together in an individual, they are said to be co-dominant
Example: The inheritance of the ABO blood group in humans is controlled by the gene I. The gene I has three allelic forms, IA, IB and i. In a human being, any two out of three alleles are presentIA and IB code for different kinds of sugar polymers present on the surface of RBC and ‘i’ does not produce any sugar.
IA and IB are dominant over ‘i’, but IA and IB are co-dominant and express themselves together.
Chromosomal Theory of Inheritance
Sutton and Boveri supported Mendel’s observations and stated that
chromosomes are the carrier of genes
Chromosomes occur as a homologous pair and the two alleles of a gene are Page 7of 6
located on the homologous pair of chromosomes at the same site
Homologous chromosomes separate during meiosis in the process of gamete
formation
Chromosomes segregate and assort independently
During fertilization, gametes combine and produce the offsprings with the
diploid no. of chromosomes, that is similar to the parent
Morgan extensively worked on fruit flies, Drosophila melanogaster and
provided experimental evidence to support the chromosomal theory of
inheritance.
NCERT LINK:https://www.learncbse.in/principles-inheritance-
variation-cbse-notes-class-12-biology/
Video links: https://youtu.be/gMxUEg25jbk
https://youtu.be/YJHGfbW55l0
https://youtu.be/M--cZ6CTRJE
DAY-4
Linkage and Recombination
Physical association of genes located on a chromosome is known as linkage.
In a dihybrid cross, if the two genes are tightly linked or present on the same chromosome than the parental combination is more prevalent than non- parental combinations or recombinants.
The linkage and recombination are directly dependent on the distance between a pair of genes. More the distance, greater is the probability of recombination.
Page 8of 6
Multiple alleles- When a trait is governed by more than two alleles, e.g. ABO
blood group
Polygenic Inheritance- When a trait is governed by multiple independent genes,
that have a similar or additive effect on the trait, it is known as polygenic
inheritance, e.g. eye colour, skin pigmentation, height, hair colour, etc.
Polygenic inheritance is also affected by environmental conditions.
Pleiotropy- When a single gene controls many phenotypic traits, it is known as a pleiotropic gene. The different phenotypic expressions are mostly a result of the effect of a gene on metabolic pathways.
E.g. a single gene mutation in the gene coding for the enzyme phenylalanine hydroxylase results in the disease known as phenylketonuria, which is
Page 9of 6
characterised by mental retardation, reduced hair and skin pigmentation.
Sex Determination There are different systems of sex determination present in different
organisms.
Henking first observed X chromosome and named it X body.
The chromosomes that determine the development of sexual characters are
known as sex chromosomes and the rest of the chromosomes are known as
autosomes
When the male produces two different kinds of gamete, it is known as male
heterogamety, e.g. humans, grasshoppers, drosophila, etc.
When the female produces two different kinds of gamete, it is known as female heterogamety, e.g. birds.
Sex determination in the honey bee:
Page 10of
Haplo-diploid sex-determination system.
Female (queen or worker) is formed by the fusion of an egg and sperm
and have diploid (32) no. of chromosomes
Male (drone) is formed from an unfertilized egg by parthenogenesis and have haploid (16) no. of chromosomes. Sperms are produced by
mitosis
NCERT LINK:https://www.learncbse.in/principles-inheritance-
variation-cbse-notes-class-12-biology/
Video links: https://youtu.be/Dzt3XdSZ1eI
https://youtu.be/eCx1TF5SZak
https://youtu.be/Ik5dfyMJkYc
Page 11of
Mutation
DAY-5
Any changes in the sequence of DNA is called a mutation.
Viable mutations get inherited from one generation to another. A
mutation changes the genotype as well as the phenotype of an
organism
It is linked to various diseases, but not all mutations are harmful Changes like, deletion, insertion, duplication, substitution, etc. result in
mutation.
A mutation is the major cause of cancer. There are many mutation inducing agents (mutagens) such as UV rays
There are two types of genetic mutation:
Point mutation:
There is a substitution in the single base pair of DNA, e.g. in the sickle
cell anaemia. The 6th codon of the gene coding for the �-globin chain
changes from GAG to GUG, resulting in the substitution of glutamine
by Valine.
Frameshift mutation:
It results from the insertion or deletion of one or more pairs of bases in
DNA. it changes the reading frame of triplet codons, that code for
certain amino acids of the protein.
Genetic Disorders
There are many disorders in the human being that are inherited and
caused due to mutation in the gene or alteration in chromosomes.
Pedigree Analysis helps in determining the risk of getting a genetic
disorder in the offsprings by studying the inheritance pattern of a
particular trait present in various generations of an individual.
Genetic disorders can be grouped into two types:
1. Mendelian Disorders
Page 13of
These are disorders due to alteration in the single gene.
It follows the same inheritance pattern, as per Mendel’s law.
Pedigree analysis can help trace the inheritance pattern and also
determine if the trait is dominant or recessive.
2. Chromosomal Disorders
These are disorders due to excess, absence or abnormal arrangement
of chromosomes.
Chromosomal disorders are of two types:
(i) Aneuploidy- Gain or loss of one or more chromosomes. It is due to
failure of segregation of chromatids during anaphase of meiosis.
(ii) Polyploidy- It is often found in plants. This happens due to an
increase in the full set of chromosomes. Failure of cytokinesis results in
polyploidy.
Some examples of chromosomal disorders:
Down’s syndrome- Trisomy of chromosome 21. Symptoms include mental
retardation, short stature, furrowed tongue, partially opened mouth.
Klinefelter’s syndrome- Total 47 chromosomes with one extra X
Page 14of
chromosome, i.e. XXY, They are sterile, tall, overall masculine with
feminine characteristics such as breast development (gynaecomastia).
Turner’s syndrome- Total 45 chromosomes. One X chromosome is missing,
i.e. XO. females are sterile, short stature and under-developed sexual
characters.
NCERT LINK:https://www.learncbse.in/principles-inheritance-
variation-cbse-notes-class-12-biology/
Video links: https://youtu.be/0q97spYaoqU
Some Questions To Practice:
Q.1. A tall plant with red flowers (dominant) is crossed with a dwarf plant
with white flowers (recessive). Work out a dihybrid cross and state the
dihybrid ratio. What will be the effect on the dihybrid ratio if the two genes
are interacting with each other?
Q.2. List out the characteristics of the chromosome theory of Inheritance.
Q.3. Why did scientists select fruit flies for his genetics experiments?
Page 15of
https://youtu.be/CrCUkYpTAm4
Q.4. Why does sickle-cell anaemia persist in the human population when it
is believed that the harmful alleles get eliminated from the population after
a certain time?
Page 16of
Page 1 of 7
BISHOP SCOTT BOYS’ SCHOOL (Affiliated to CBSE, New Delhi) Affiliation No.: 330726, School Campus: Chainpur, Jaganpura,
By-Pass, Patna 804453.
Phone Number: 7061717782, 9798903550. ,
Web: www.bishopscottboysschool.com Email: [email protected]
STUDY COURSE MATERIAL
MATHEMATICS SESSION-2021-22
CLASS-12TH
CHAPTER : INTEGRALS
DAY-1
NCERT MATERIAL https://ncert.nic.in/textbook.php?lemh2=1-7
VIDEO LINK : https://www.youtube.com/watch?v=S-XKGBesRzk
Integration by partial fraction:
Page 3 of 7
Example: Resolve
𝑥3−6𝑥2+10𝑥−2
𝑥2−5𝑥+6 into partial fractions.
DAY-2
VIDEO LINK : https://youtu.be/CMG6ucGUQiU
FUNDAMENTAL THEOREM OF INTEGRAL CALCULUS
Page 5 of 7
DAY-3 VIDEO LINK : https://youtu.be/C7ducZoLKgw
Evaluate the following definite integrals as limit of sums.
1. ∫ 𝑥 𝑑𝑥𝑏
𝑎
2. ∫ (𝑥 + 1)𝑑𝑥 5
0
3. ∫ (𝑥2 − 𝑥)𝑑𝑥4
1
Page 6 of 7
DAY-4 VIDEO LINK : https://www.youtube.com/watch?v=nopnFjMy3rQ
Some properties of definite integrals :
Evaluate :
1. ∫ log sin 𝑥 𝑑𝑥𝜋/2
0
Page 7 of 7
2. ∫ |𝑥3 − 𝑥|𝑑𝑥 2
−1
3. ∫ 𝑠𝑖𝑛2𝑥 𝑑𝑥 𝜋/4
–𝜋/4
DAY-5 VIDEO LINK : https://www.youtube.com/watch?v=JMqKtEC2bbY
Solve the following questions:
Page 1 of 6
BISHOP SCOTT BOYS’ SCHOOL (Affiliated to CBSE, New Delhi) Affiliation No.: 330726, School Campus: Chainpur, Jaganpura,
By-Pass, Patna 804453.
Phone Number: 7061717782, 9798903550. , Web: www.bishopscottboysschool.com Email: [email protected]
SUBJECT COURSE MATERIALS(SCM-08)
SUBJECT-_ECONOMICS(030)______
SESSION-2021-22
CLASS-_XII
Human Capital Formation
DAY-01
Human Capital
Human Capital It refers to the stock of ‘skill and expertise’ of a nation at a point of time. It is the
sum total of skill and expertise.
Human Capital Formation It is the process of adding to the stock of human capital over time.
Physical Capital It refers to the stock of produced means of production. It consists of machines,
production plants etc.
Financial Capital It refers to the stocks/shares of the companies or these are simple financial claims
against assets of the companies.
Major Sources of Human Capital in Country
1. Expenditure on Education: It is one of the primary sources of human capital development.
Investment in education is not only highly productive, but it also generates growing returns
and promotes economic progress. Of all the resources, education receives the greatest
attention because it contributes the most to the country's development.
2. Expenditure on Health: Health is a crucial factor for the development of a nation. An ailing
individual with insufficient health and medicare facilities is forced to stop working, resulting
in a loss of output, also in case the said individual works despite poor health, then also there
is a loss of productivity and output. The various forms of health expenditure are preventive
medicine, curative medicine, social medicine, provision of clean drinking water,
3. On the job training: On and off campus training of employees, in terms of training by a
supervisor in the firm itself, or training at an off campus location enhances the skill and
productivity of an individual, and makes him more accustomed to the work environment and
work he is supposed to do.
Page 2 of 6
4. Migration: Migration to other locations within or outside the country either due to
unemployment or better professional opportunities is also a source of human capital formation.
5. Information: A person incurs expenses in terms of acquiring information about labour
markets, product markets, capital markets, and education, health in order to ensure efficient
utilisation of human stock and take better decisions regarding them. This is also a part of human
capital formation.
DAY-2
Importance of Human Capital Formation
1. Boosts productivity: Human capital development through investment in education boosts
productivity and output by ensuring that workers are aware and skilled (use of the resources).
Increased productivity and quality output are dependent on people's technical skills, which
can only be acquired through the investment in education or training, as well as their overall
health.
2. Control of population growth: It has been noticed that educated people have smaller
families than illiterate people, implying that education must be widely diffused to reduce
population growth.
3. Improves Quality of life: The quality of a population is determined by a person's degree of
education, health, and skill development. Human capital development not only makes people
more productive and creative, but it also changes their lives.
4. Increases life expectancy: Human capital development increases people's life expectancy.
People can live a healthy and long life if they have access to health care and nutritious food.
As a result, the quality of life improves.
5. Effective use of physical capital: A person who is well trained, with appropriate skills will
have a better understanding of the physical tools and equipment, as well as he will be able to
find out the best possible ways to make the best use of them.
Reasons for Poor Human Capital Formation
1. Insufficient Resources: The resources given to the development of human capital have been
far less than those required to meet the country's educational and health demands. As a result,
the facilities for developing human capital have remained woefully inadequate.
2. Serious Inefficiencies: There are numerous wastes of society's resources because the
capabilities of educated individuals are either not exploited or are underutilized while they
are unemployed. Other inefficiencies that have not been promptly and appropriately
addressed include widespread literacy, the non-education of children, especially in rural areas
and slums, and poor health facilities.
3. High Growth of population: The quality of human capital has deteriorated as the population
continues to grow.
Page 3 of 6
4. Lack of proper manpower planning: There is a mismatch between demand and supply for
numerous categories of human resources, particularly in the case of highly qualified
employees. Waste of human resources has come from the lack of such balancing.
5. High Poverty Levels: Majority of the population lives in poverty, and they don’t even have
access to the three basic necessities of life, this ultimately impacts the building of human
capital.
DAY-03
Physical Capital
It encompasses all the inputs required for further production, such as plant and machinery, factories,
buildings, raw materials, and so on.
Difference Between Human Capital and Physical Capital
Basis Human Capital Physical Capital
Tradability
Human capital is an intangible asset that
cannot be purchased on the open
market.
Physical capital is observable and can be
easily traded.
Depreciation
Human capital depreciation can be
reduced by continuing to invest in
education, health, and education.
With the passage of time, it depreciates.
Mobility Human capital is less mobile between
countries. It is more movable across borders.
Seperation Human capital (such as a person's skills)
cannot be divorced from one's own.
Separation of physical capital (such as
machinery) from its owners.
Origination
Human capital formation is partly a
social process and partly a voluntary
decision of the human capital possessor.
Physical capital is the result of the
owner's deliberate decision and is
primarily an economic and technological
process.
Creation
Human capital building should be
accomplished by deliberate policy
formulation.
It is simple to form with machines.
Difference between Human Capital and Human Development
Basis Human Capital Human Development
Page 4 of 6
Viewpoint
Human capital views education
and health as ways to boost labour
productivity.
Human development is based on the belief
that education and health are essential
components of human well-being.
Investment in
education and
health
Investment in education and
health is considered unproductive
in human capital if it does not
boost output of commodities and
services.
Investment in education and health are
considered productive in the case of human
development, even if they do not result in
increased output.
Focus
Human capital views people to an
end, with the goal of increasing
production.
From the standpoint of human development,
human welfare should be enhanced by
investments in education and health, as
every individual has the right to be literate
and live a healthy life.
DAY-04
Education
It refers to the process of teaching, training, and learning, which takes place mostly in schools and
colleges, to increase their knowledge and skills.
Growth of Education Sector in India
In the sphere of education, there has been significant progress. From 1950 to 1951, the number of
schools climbed from 230.7 thousand to 1,215.8 thousand (2005-06). During the same time, the
number of teachers climbed from 751 thousand to 6010 thousand, while the number of pupils
increased from 23,800 thousand to 2,22,700 thousand.
Gross Enrollment Ratio
The Gross Enrollment Ratio (GER) is the total number of students enrolled in a grade, cycle, or
level of education, regardless of age, represented as a percentage of the population of the matching
eligible official age group in a particular school year. From 82 percent in 1950-51 to 94.85 percent
in 2005-06, GER in primary education has gradually increased.
Education Sector in India
Elementary Education: Elementary education in India entails eight years of learning
beginning at the age of six, i.e., primary, and middle school education combined. As a result,
elementary education is the bedrock upon which the development of all citizens and the
nation is built. Elementary education has been made compulsory and free by the government.
However, achieving the goal of universal primary education in India has proven to be a
difficult task.
Secondary Education: Secondary education, which begins in grades IX and X and ends in
grades XI and XII, strives to develop basic skills and analytical ability. It serves as a
stepping- stone to more advanced professional and technical training.
Page 5 of 6
Higher Education: Both general and technical education are part of the higher education
system. Since independence, higher education has grown in leaps and bounds. The country's
university population has grown from 27 in 1950-51 to 350 in 2005-06.
The University Funding Commission (UGC) is responsible for promoting and coordinating
university education, as well as determining and maintaining standards in teaching, assessment, and
research, as well as allocating and disbursing grants to universities.
Problems/ Weakness in Education Sector
1. High Illiteracy: According to the 2001 census, the literacy rate was 64.8 percent, which is
still considerably below the national average of 100 percent.
2. Gender Bias: In India, education is skewed toward women. The number of girls enrolled in
basic and upper primary levels is significantly lower than that of boys.
3. Low Quality Education: The educational system is of poor quality, with major focus on
theory and learning, and less consideration to practical learning. Though the new education
policy has a number of positive aspects that may contribute to the betterment of the education
sector in India.
4. Lack of Vocational and Technical Training: There is an overabundance of emphasis on
general education, which neglects vocational and technical education.
5. Low Level of Government Expenditure: The actual amount of spending is far less than the
desired level of expenditure which should be made.
DAY-05
Future Prospects India government considers education a key sector where considerable growth and.development is required.
Thus, it has set some future prospects for framing its policies.
These prospects are discussed below
Education for All : Still a Distant Dream
Although the education level in India has risen for both adults as well as for youth. Still the number of
illiterates in India are as much as the population was at the time of Independence.
In 1950, when the Constitution of India was passed by the constituent assembly, it was noted in the directive
principles of the constitution that the government should provide free and compulsory education for all
children up to the age of 14 years within 10 years from the commencement of the constitution.
The following factors makes education still a distant dream
Large number of illiterates
Inadequate vocationalisation
Gender bias
Low rural access level
Privatisation
Low government expenditure on education
Gender Equity : Better than Before
The differences in literacy rates between males and females are narrowing, signifying a positive
development in gender equity; still the need to promote education for women in India is imminent for
various reasons, such as
Page 6 of 6
Improving economic independence.
Social status of women.
Healthcare of women and children.
Therefore, we cannot show the satisfaction about the upward movement in literacy rates as we have miles to
go in achieving cent percent adult literacy.
In India, Mizoram, Kerala, Goa and Delhi are the states having high literacy rate, while Bihar, Uttar
Pradesh, Rajasthan and Arunachal Pradesh are the educationally backward states. The educational
backwardness is due to social and economic poverty of the people.
Higher Education : A Few Takers
The Indian education pyramid is steep, indicating lesser and lesser number of people reaching the higher
education level.
As per NSSG (National Sample Survey Organisation) data, in the year 2007-08, the rate of unemployment
for youth with education up to secondary level and above was 18.1% whereas, the rate of unemployment for
youth with education up to primary level was only 11.6%.
Therefore, the government should increase allocation for higher education and also improve the standard of
higher education institutes, so that students are imparted employable skills in such institutions
BISHOP SCOTT BOYS’ SCHOOL (Affiliated to CBSE, New Delhi) Affiliation No.: 330726, School Campus: Chainpur, Jaganpura,
By-Pass, Patna 804453.
Phone Number: 7061717782, 9798903550. ,
Web: www.bishopscottboysschool.com Email: [email protected]
STUDY COURSE MATERIAL
PHYSICAL EDUCATION SESSION-2021-22
CLASS-12
TEST AND MEASUREMENT IN SPORTS
Computation of Fat Percentage The fat percentage or the amount of fat a person carries and whether he/she is normal, underweight or overweight can be calculated through computation of fat percentage. This can be done by BMI Body Mass Index (BMI) is a measure of body fat calculated on the basis of height and weight. To calculate BMI, take the weight in kilograms and divide it by square of height taken in metres.
𝐵𝑀𝐼 =𝐵𝑜𝑑𝑦 𝑤𝑒𝑖𝑔ℎ𝑡 𝑖𝑛 𝑘𝑔
(𝐻𝑒𝑖𝑔ℎ𝑡 𝑖𝑛 𝑚𝑒𝑡𝑒𝑟𝑠)2
With the help of BMI, it is determined whether a person in normal, underweight overweight.
BMI WEIGHT STATUS
Below 18.5 Underweight
18.5-24.9 Normal
25.0-29.9 Overweight
30.0 and above Obese
Slaughter-Lohman Children Skinfold This is a standard skinfold test for measuring body fat in children under the age group of 6-17 years. The digital skinfold calliper is used to measure the triceps and calf region and then the measurement is inserted into a formula.
Slaughter-Lohman Children Skinfold Formula For Triceps, measure vertically on back of arm midway between top of shoulder point and elbow. For Calf, measure the inside of the right lower leg at the place where there is greatest calf girth.
Formula for males (6 to 17 years):
% body fat = (0.735 x sum of skinfold + 1.0)
Formula for females (6 to 17 years):
% body fat = (0.610 x sum of skinfold + 5.1)
Sum of skinfolds = Triceps + Calf
Measurement of Muscular Strength Muscular strength refers to the amount of force the muscle or group of muscles can exert against resistance for short duration like in anaerobic activities. Muscular strength can be measured by Kraus Weber Test.
Kraus Weber Test Kraus Weber Test originated in a posture clinic and was developed as a diagnosis and treatment of low back pain. Soon, it became familiar as Kraus Weber test of minimum muscular fitness. The test consists of six items which indicate the level of muscular strength and flexibility of key muscle groups.
Note - The tests are done without the subject wearing shoes. The six test items of the Kraus Weber muscular strength test are given below
1. Abdominals Plus Psoas (hip flexing) Muscles
2. Abdominals Minus Psoas
3. Psoas or P
4. Upper Back or UB
5. Lower Back or LB
6. Back and Hamstring or BH
Motor Fitness Test-AAHPER The AAHPER (American Alliance for Health, Physical Education and Recreation) youth fitness test was formed in 1965 in the United States, but this was revised in 1976. Now dance (AAHPERD) is also added. This test was administered on school students of 17 years age. The students are advised to warm up before they participate in the test. All the students must be medically fit. This test has the following six items:
1. (a) Pull-Ups (For Boys)
Purpose To measure arm and shoulder strength.
Procedure The bar is adjusted according to the height of the boy. The bar is held with palms facing away. He is then asked to raise his body so that the chin reaches the level of the bar. One score is awarded for each pull-up. One trial is given before the start of the test.
(b) Flexed Arm Flang (For Girls)
Purpose To measure arm and shoulder strength.
Procedure The bar is adjusted according to the standing height of the girl. The bar is held with over hand grasp. The girl lifts her body up with the assistance of testing personnel so that her chin reaches the bar level. The time in seconds she holds the bar is taken as her score.
2. Flexed Leg Sit-ups
Purpose To measure abdominal strength and endurance.
Procedure The youth is asked to lie on the floor on his/ her back keeping knees bent. The angle of knees should be around 90°. The feet are held by a partner,’ the youth’ puts hands behind the head with fingers interlocked. Then the youth curls up and touches the elbows to knees. The score is counted as maximum number of sit-ups in 60 sec.
3. Shuttle Run
Purpose To measure speed and agility.
Procedure Two parallel lines are marked 30 feet apart and two wooden-blocks 2 x 2 x 4 inches are kept on one side of a marked line. The youth stands behind the line opposite to the line where wooden blocks are placed. At the start signal, the youth runs towards the wooden blocks and picks up one of them, carrying it back to the line from where the test started. Then places it behind the line, runs back, picks up the second block and carries back-to the starting line. Two trials are allowed and best score of the two is noted down.
4. Standing Long Jump
Purpose To measure power.
Procedure The youth is asked to stand behind the restraining line with feet apart and he/she bends the knees and swings arms before jumping. The youth lands on both feet together. The distance from take-off line to the heel is measured in inches. The best of three trials is recorded as the final score.
5. 50 Yard Dash
Purpose To measure speed.
Procedure The youth is asked to run 50 yards from the starting line and the time is recorded nearest to one-tenths of a second.
6. 600 Yard Run-Walk
Purpose To measure endurance.
Procedure The youth is asked to run and/or walk for 600 yards and the time is recorded in minutes and seconds. This can be run in an open field or the inside track of an athletic field, by marking the distances appropriately.
General Motor Fitness General motor fitness is an athlete’s general ability to perform different motor skills without getting too much fatigued. General motor ability consists of three items designed to test the motor ability of school and college boys and girls.
Test 1 Standing Broad Jump This test measures the explosive leg power. In this test, the student stands behind the restraining line, with feet several inches apart and the toes pointed straight ahead. The student should swing the arms forward, extend the knees and jump forward as far as possible.
Test 2 Zig – Zag run The materials, required are a stop-watch, five traffic cones, floor measuring tape and floor area of 30 feet by 50 feet. Cones are placed on the floor in a zig – zag manner. The objective is to measure the agility. The examine or the student stands at the starting point. On the signal ‘go’, he/she runs the course without touching the cones. The student continues to run the course three times and each time, the time is recorded with the help of a stopwatch. The score is the time recorded to the nearest tenth of a second. If the cones are moved during the run, then the trial is retaken.
Test 3 Medicine Ball Put The material required is medicine ball. The objective is to measure arm and shoulders girdle explosive strength. The student is required to put a 6 pound medicine ball as far as possible. Three trials are taken and the best score of the three is recorded. For boys the explosive strength throw test is for 3 kg medicine ball and for girls it is 1 kg.
Measurement of Cardiovascular Fitness Cardiovascular fitness is the ability of the heart and lungs to supply oxygen, rich blood to the working
muscle tissues and the ability of the muscles to use oxygen to produce energy for movements. This type of fitness is required to sustain physical activity and is essential for performing aerobic activities.
1. Harvard Step Test This test is also known as Aerobic Fitness test. It was developed by Brouha and others in 1943. It is used to measure the cardiovascular fitness or aerobic fitness by checking the recovery rate. Equipment Required Bench 20 inches high, for men and 16 inches for women, stopwatch and metronome.
2. Rockport Test This test also known as Rockport One Mile Test or Rockport Fitness Walking Test is used for testing cardiovascular fitness. It requires minimal equipment. This test consists of walking, which may be easy for middle-aged and older adults. This test tells us about the aerobic fitness of an individual. Equipment Required 400m track, stopwatch and weighing scale.
Computation of Fitness Index Fitness index is computed using the following formula:
𝐹𝐼 =𝐷𝑢𝑟𝑎𝑡𝑖𝑜𝑛 𝑜𝑓 𝑒𝑥𝑒𝑟𝑐𝑖𝑠𝑒 𝑖𝑛 𝑠𝑒𝑐𝑜𝑛𝑑𝑠 ∗ 100
(2 ∗ 𝑆𝑢𝑚 𝑜𝑓 𝑝𝑢𝑙𝑠𝑒 𝑐𝑜𝑢𝑛𝑡𝑠 𝑖𝑛 𝑟𝑒𝑐𝑜𝑣𝑒𝑟𝑦)
𝐹𝐼 =𝐷𝑢𝑟𝑎𝑡𝑖𝑜𝑛 𝑜𝑓 𝑒𝑥𝑒𝑟𝑐𝑖𝑠𝑒 𝑖𝑛 𝑠𝑒𝑐𝑜𝑛𝑑𝑠 ∗ 100
(5.5 ∗ 𝑃𝑢𝑙𝑠𝑒 𝑐𝑜𝑢𝑛𝑡 𝑏𝑒𝑡𝑤𝑒𝑒𝑛 1 𝑎𝑛𝑑 1.5 𝑚𝑖𝑛𝑢𝑡𝑒𝑠)
Rikli and Jones- Senior Citizen Fitness Test Rikli and Jones prepared various physical fitness tests for senior citizens in 2001. Senior citizens can’t do exhaustive workouts however fitness is very important even in old age.
These tests are designed to access the functional fitness of older adults with the help of simple activities like getting up from a chair, walking, bending and stretching. These tests are safe, enjoyable and meet scientific standards of reliability and validity. That is why easy tests prepared for different body parts are given. These are:
1. Chair Stand Test for Lower Body Strength The Chair Stand Test is similar to a squat test to measure leg strength. This test is part of the senior fitness test protocol and is designed to test the functional fitness of seniors.
Purpose This test assesses leg strength and endurance of senior citizens.
Equipment Required A straight or folding chair without arm rests (seat 17 inches/ 44 cm high) and stopwatch.
2. Arm Curl Test for Upper Body Strength The Arm Curl Test is a test to measure the upper body strength of senior citizens or old people.
Purpose This test measures upper body strength and endurance.
Equipment Required 5 pound weight for women, 8 pound weight for men, a chair without arm rests, stopwatch.
3. Chair Sit and Reach Test for Lower Body Flexibility The Chair Sit and Reach Test is part of-the senior fitness test protocol, and is designed to test the functional fitness of seniors. It is a variation of the traditional sit and reach . flexibility test.
Purpose This test measures lower body. – flexibility.
Equipment Required Ruler, a chair with straight back or folding chair (17 inch/44 cm high).
4. Back Scratch Test for Upper Body Flexibility The shoulder stretch is a simple flexibility test to determine if the hands can be brought together behind the back particularly the shoulders. This test is part of the fitness programme as an alternative to the back saver sit and reach test.
Purpose This test measures upper arm and shoulder girdle flexibility.
Equipment Required None.
5. Eight Foot Up and Go Test for Agility The Eight Foot Up arid Go Test is a coordination and agility test’for the elderly-which is pair of the senior fitness test protocol.
Purpose This test measures speed, agility and balance while moving.
Equipment Required Stopwatch, straight back or folding chair ( seat 17 inches/44 height) cone rriarker, measuring tape, area clear of obstacles.
6. Six Minute Walk test for Aerobic Endurance The Six Minute Walk Test is a part, of the senior fitness test protocol arid is designed to test the functional fitness of seniors. It is an adaptation of the Cooper 12 – minutes run for people who use orthopaedic devices When walking as well as people who have difficulty in balancing.
Purpose This test measures aerobic fitness or aerobic endurance.
Equipment Required Measuring tape to mark out the track distances, stopwatch arid chairs positioned for testing.
Page 1 of 25
BISHOP SCOTT BOYS’ SCHOOL (Affiliated to CBSE, New Delhi) Affiliation No.: 330726, School Campus: Chainpur, Jaganpura,
By-Pass, Patna 804453.
Phone Number: 7061717782, 9798903550. , Web: www.bishopscottboysschool.com Email: [email protected]
ONLINE STUDY MATERIAL
SUBJECT-IP SESSION-2021-22
CLASS-XII
TOPIC: CSV WITH DATAFRAME AND PANDAS-II
DAY-1
NOTES
CHAPTER 07: WORKING WITH CSV FILES
INTRODUCTION
When you export data from Website, the files can be delivered in the following formats
1. CSV - COMMA SEPARATED VALUES
2. PSV - PIPE SEPARATED VALUES
3. TSV - TAB SEPARATED VALUES
1. CSV - COMMA SEPARATED VALUES
A CSV(Comma Separated Values) is a plain-text file format used to store tabular data such as a spreadsheet
or a database. It essentially stores a tabular data which comprises of numbers and text into plain text.
2. PSV - PIPE SEPARATED VALUES
When you export contact data and survey data from the Gateway eNews letter and Website systems, the
files will be delivered in a "pipe delimited" format. This means that the various columns are separated by
a pipe character.
3. TSV - TAB SEPARATED VALUES
A text file format that uses tab characters as separators between fields. The tab delimited format stores
information from a database or spreadsheet in the format of a tabular structure. Both Microsoft and Google
allow the user to convert a spreadsheet into tab delimited format.
WHAT IS A CSV FILE?
A CSV file is a type of plain text file that uses specific structuring to arrange tabular data. CSV is a
common format for data interchange as it's compact, simple and general. Many online services allow its users
to export tabular data from the website into a CSV file. Files of CSV will open into Excel, and nearly all
Page 2 of 25
databases have a tool to allow import from CSV file. The standard format is defined by rows and columns
data. Moreover, each row is terminated by a newline to begin the next row. Also within the row, each column
is separated by a comma.
CSV (Comma-separated values) is a common data exchange format used by the applications to
produce and consume data. Some other well-known data exchange formats are XML, HTML, JSON
etc.
A CSV file is a simple text file where each line contains a list of values (or fields) delimited by commas.
Although the term "Comma" appears in the format name itself, but you will encounter CSV files where data is delimited using tab (\t) or pipe (|) or any other character that can be used as a delimiter.
The first line of the CSV file represents the header containing a list of column names in the file. The header is optional but highly recommended.
The CSV file is commonly used to represent tabular data. For example, consider the following table:
To retain the commas inside the Address field enclose it in double quotation marks, as follows:
Tabular data is represented by comma separated values
RollNo,Name,Age,Class,Sec
1023,Vishwa,14,VII,A
3078,Varun,16,X,B
3543,Gowtham,15,X,C
Every line of the file is called a record. And each record consists of fields that are separated
by commas which are also known as “delimiter” which is the default delimiter, others include pipe(|),
semicolon(;). Given below is a structure of a Normal CSV File separated by a comma
Page 3 of 25
WHY IS CSV FILE FORMAT USED?
CSV is a plain-text file which makes it easier for data interchange and also easier to import onto
spreadsheet or database storage.
For example: You might want to export the data of a certain statistical analysis to CSV file and then
import it to the spreadsheet for further analysis. Overall it makes users working experience very
easy programmatically. Any language supporting a text file or string manipulation like Python can
work with CSV files directly.
CSV ADVANTAGES
CSV is human readable and easy to edit manually
CSV is simple to implement and parse
CSV is processed by almost all existing applications
CSV provides a straightforward information schema
CSV is faster to handle
CSV is smaller in size
CSV is considered to be standard format
CSV is compact. For XML you start tag and end tag for each column in each row. In CSV you
write the column headers only once.
CSV is easy to generate
CSV DISADVANTAGES
CSV allows to move most basic data only. Complex configurations cannot be imported and
exported this way
There is no distinction between text and numeric values
No standard way to represent binary data
Problems with importing CSV into SQL (no distinction between NULL and quotes)
Poor support of special characters
No standard way to represent control characters
Lack of universal standard
VIDEO-LINKS
https://www.youtube.com/watch?v= JzkDsPBy8&feature=youtu.be
Page 4 of 25
DAY-2
CSV FILE TYPES
1. CSV (COMMA DELIMITED)
2. CSV UTF-8 (COMMA DELIMITED)
3. CSV (MACINTOSH)
4. CSV (MS-DOS)
1. CSV (COMMA DELIMITED)
A comma-separated values file is a delimited text file that uses a comma to separate values.
Each line of the file is a data record. Each record consists of one or more fields, separated by
commas. Exporting to CSV uses a default encoding of Unicode (UTF-16le)
2. CSV UTF-8 (COMMA DELIMITED)
UTF-8 (Unicode Transformation Format -8 ) encoding, also referred to as "Unicode - UTF8" UTF-
8 encoded CSV files will work well with Accompa (Accompa is a leading cloud-based requirements
management software that helps you capture, track and manage requirements for your products &
projects). just English characters, or also contain non-English characters such as é, ç, ü
3. CSV (MACINTOSH)
CSV (Macintosh) .csv. Saves a workbook as a comma-delimited text file for use on
the Macintosh operating system, and ensures that tab characters, line breaks, and other characters
are interpreted correctly.
Page 5 of 25
4. CSV (MS-DOS)
CSV (DOS).csv. Saves a workbook as a comma-delimited text file for use on
the Macintosh operating system, and ensures that tab characters, line breaks, and other characters
are interpreted correctly.
PYTHON CSV MODULE
Python uses a CSV package which is a part of the standard library, so you need not install it.
Python CSV package contains following functions:
Ser Functions Description
1 csv.field_size_limit It returns the maximum field size
2 csv.get_dialect Fetches the dialect associated with name
3 csv.list_dialects Displays all the registered dialects
4 csv.reader Read data from csv file
5 csv.register_dialect Dialect associated with a name
6 csv.writer Writes data to a csv file
7
csv.unregister_dialect
It deletes the dialect associated with the name
dialect registry
8 csv.QUOTE_ALL Quotes everything irrespective of the type
9 csv.QUOTE_MINIMAL Quotes special character field
10 csv.QUOTE_NONNUMERIC Quotes fields that are not numeral
11 csv.QUOTE_NONE Doesn’t quote anything in output
READING AND WRITING FILES
Page 6 of 25
The csv module is used for reading and writing files. It mainly provides following classes and functions:
1. reader()
2. writer()
3. DictReader()
4. DictWriter()
1. READING A CSV FILE WITH reader()
The reader() function takes a file object and returns a _csv.reader object that can be used to iterate over the contents of a CSV file. The syntax of reader() function is as follows:
Syntax: reader(fileobj [, dialect='excel' [, **fmtparam] ]) -> _csv.reader
Argument Description
fileobj (required) It refers to the file object
dialect (optional) Dialect refers to the different ways of formatting the CSV document. By
default, the csv module uses the same format as Microsoft Excel. We will discuss
dialect in detail later in this post.
fmtparam (optional) It refers to the set of keyword arguments to customize the dialect (see the
next section).
Let's say we have following CSV file:
employees.csv
Page 7 of 25
1 2 3 4
id,name,email,age,designation 1,John,[email protected],24,programmer 2,Bob,[email protected],34,designer 3,Mary,[email protected],43,sales
import csv
with open('employees.csv', 'rt') as f:
csv_reader = csv.reader(f)
for line in csv_reader:
print(line)
Here is how to read this CSV file:
Expected Output:
1 2 3 4
['id', 'name', 'email', 'age', 'designation'] ['1', 'John', '[email protected]', '24', 'programmer'] ['2', 'Bob', '[email protected]', '34', 'designer'] ['3', 'Mary', '[email protected]', '43', 'sales']
Notice that each line in the CSV file is returned as a list of strings.
To get the data from certain fields, you can use indexing. For example:
1 2 3 4 5 6 7
import csv with open('employees.csv', 'rt') as f:
csv_reader = csv.reader(f)
for line in csv_reader: print(line[0], line[1], line[2])
Expected Output:
1 2 3 4
id name email 1 John [email protected] 2 Bob [email protected] 3 Mary [email protected]
If you want to skip heading call the next() built-in function on the _csv.reader object and then loop over the remaining lines as usual.
Page 8 of 25
VIDEO-LINKS
https://www.youtube.com/watch?v= JzkDsPBy8&feature=youtu.be
DAY-3
1 2 3 4 5 6 7 8 9
import csv
with open('employees.csv', 'rt') as f: csv_reader = csv.reader(f)
next(csv_reader) # skip the heading
for line in csv_reader: print(line[0], line[1], line[2])
Expected Output:
1 2 3
1 John [email protected] 2 Bob [email protected] 3 Mary [email protected]
CUSTOMIZING THE reader()
By default, the csv module works according to the format used by Microsoft excel, but you can also define your own format using something called Dialect.
The following are some additional arguments that you can pass to the reader() function to customize its working.
delimiter - It refers to the character used to separate values (or fields) in the CSV file. It defaults to
comma (,).
skipinitialspace - It controls how the space following the delimiter will be interpreted. If True , the
initial whitespaces will be removed. It defaults to False.
lineterminator - It refers to the character sequence used to terminate the line. It defaults to \r\n.
quotechar - It refers to the single character string that will be used to quote values if special characters
(like delimiter) appears inside the field. It defaults to ".
quoting - controls when quotes should be generated by the writer or recognized by the reader. It can
take one of the following constants:
o csv.QUOTE_MINIMAL means add quote only when required, for example, when a field contains either the quotechar or the delimiter. This is the default.
o csv.QUOTE_ALL means quotes everything regardless of the field type.
Page 9 of 25
o csv.QUOTE_NONNUMERIC means quotes everything except integers and floats.
o csv.QUOTE_NONE means that do not quote anything on output. However, while reading quotes are included around the field values.
escapechar - It refers to the one-character string used to escape the delimiter when quoting is set
to QUOTE_NONE. It defaults to None.
doublequote - controls the handling of quotes inside fields. When True, two consecutive quotes are
interpreted as one during read, and when writing, each quote character embedded in the data is written
as two quotes. Let's workthrough some examples to better understand how these arguments work:
DELIMITER ARGUMENT
employees_pipe.csv
1 2 3 4
id|name|email|age|designation 1|John|[email protected]|24|programmer 2|Bob|[email protected]|34|designer 3|Mary|[email protected]|43|sales
This file uses pipe (|) character as a delimiter. Here is how to read this CSV file:
1 2 3 4 5 6 7
import csv with open('employees.csv', 'rt') as f:
csv_reader = csv.reader(f, delimiter='|')
for line in csv_reader: print(line)
Expected Output:
1 2 3 4
['id', 'name', 'email', 'age', 'designation'] ['1', 'John', '[email protected]', '24', 'programmer'] ['2', 'Bob', '[email protected]', '34', 'designer'] ['3', 'Mary', '[email protected]', '43', 'sales']
SKIPINITIALSPACE ARGUMENT
baseball_players.csv
1 2 3 4 5 6 7 8 9
"Name", "Team", "Position", "Height(inches)", "Weight(lbs)", "Age" "Adam Donachie", "BAL", "Catcher", 74, 180, 22.99 "Paul Bako", "BAL", "Catcher", 74, 215, 34.69 "Ramon Hernandez", "BAL", "Catcher", 72, 210, 30.78 "Kevin Millar", "BAL", "First Baseman", 72, 210, 35.43 "Chris Gomez", "BAL", "First Baseman", 73, 188, 35.71 "Brian Roberts", "BAL", "Second Baseman", 69, 176, 29.39 "Miguel Tejada", "BAL", "Shortstop", 69, 209, 30.77 "Melvin Mora", "BAL", "Third Baseman", 71, 200, 35.07
Page 10 of 25
This CSV file contains spaces following the comma (,). To read this CSV file correctly, set skipinitialspace to True, as follows:
1 2 3 4 5 6 7
import csv with open('baseball_players.csv', 'rt') as f:
csv_reader = csv.reader(f, skipinitialspace=True)
for line in csv_reader: print(line)
Expected Output:
1 2 3 4 5 6 7 8 9
['Name', 'Team', 'Position', 'Height(inches)', 'Weight(lbs)', 'Age'] ['Adam Donachie', 'BAL', 'Catcher', '74', '180', '22.99'] ['Paul Bako', 'BAL', 'Catcher', '74', '215', '34.69'] ['Ramon Hernandez', 'BAL', 'Catcher', '72', '210', '30.78'] ['Kevin Millar', 'BAL', 'First Baseman', '72', '210', '35.43'] ['Chris Gomez', 'BAL', 'First Baseman', '73', '188', '35.71'] ['Brian Roberts', 'BAL', 'Second Baseman', '69', '176', '29.39'] ['Miguel Tejada', 'BAL', 'Shortstop', '69', '209', '30.77'] ['Melvin Mora', 'BAL', 'Third Baseman', '71', '200', '35.07']
WRITING CSV FILES WITH writer()
To write data to a CSV file we use the writer() function. It accepts the same argument as the reader() function but returns a writer object (i.e _csv.writer):
Syntax: writer(fileobj [, dialect='excel' [, **fmtparam] ]) -> csv_writer
ARGUMENT DESCRIPTION
fileobj (required) It refers to the file object
dialect (optional) Dialect refers to the different ways of formatting the CSV
document. By default, the csv module uses the same format as
Microsoft Excel. We will discuss dialect in detail later in this post.
fmtparam (optional) Formatting parameters, work same as the reader()'s function.
Page 11 of 25
The writer instance provides the following two methods to write data:
Method Description
writerow(row) Writes a single row of data and returns the number of characters written.
The row must be a sequence of strings and number.
writerows(rows) Writes multiple rows of data and returns None. The rows must be a sequence.
VIDEO-LINKS
https://www.youtube.com/watch?v= JzkDsPBy8&feature=youtu.be
DAY-4
Example 1: Using writerow()
Page 12 of 25
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import csv header = ['id', 'name', 'address', 'zip'] rows = [
[1, 'Hannah', '4891 Blackwell Street, Anchorage, Alaska', 99503 ], [2, 'Walton', '4223 Half and Half Drive, Lemoore, California', 97401 ], [3, 'Sam', '3952 Little Street, Akron, Ohio', 93704], [4, 'Chris', '3192 Flinderation Road, Arlington Heights, Illinois',
62677], [5, 'Doug', '3236 Walkers Ridge Way, Burr Ridge', 61257],
] with open('customers.csv', 'wt') as f:
csv_writer = csv.writer(f)
csv_writer.writerow(header) # write header
for row in rows: csv_writer.writerow(row)
Example 2: Using writerows()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import csv header = ['id', 'name', 'address', 'zip'] rows = [
[1, 'Hannah', '4891 Blackwell Street, Anchorage, Alaska', 99503 ], [2, 'Walton', '4223 Half and Half Drive, Lemoore, California', 97401 ], [3, 'Sam', '3952 Little Street, Akron, Ohio', 93704], [4, 'Chris', '3192 Flinderation Road, Arlington Heights, Illinois',
62677], [5, 'Doug', '3236 Walkers Ridge Way, Burr Ridge', 61257],
] with open('customers.csv', 'wt') as f:
csv_writer = csv.writer(f)
csv_writer.writerow(header) # write header
csv_writer.writerows(rows)
The output generated by both listing will be the same and it looks like this:
customers.csv
1 2 id,name,address,zip 1,Hannah,"4891 Blackwell Street, Anchorage, Alaska",99503
Page 13 of 25
3 4 5 6
2,Walton,"4223 Half and Half Drive, Lemoore, California",97401 3,Sam,"3952 Little Street, Akron, Ohio",93704 4,Chris,"3192 Flinderation Road, Arlington Heights, Illinois",62677 5,Doug,"3236 Walkers Ridge Way, Burr Ridge",61257
Notice that only the address field is wrapped around double quotes. This is because by default the quoting argument is set to QUOTE_MINIMAL. In other words, fields will be quoted only when quotechar or delimiter appears in the data.
Let's say you want double quotes around all textual data. To achieve this, set quoting argument to QUOTE_NONNUMERIC.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import csv header = ['id', 'name', 'address', 'zip'] rows = [
[1, 'Hannah', '4891 Blackwell Street, Anchorage, Alaska', 99503 ], [2, 'Walton', '4223 Half and Half Drive, Lemoore, California', 97401 ], [3, 'Sam', '3952 Little Street, Akron, Ohio', 93704], [4, 'Chris', '3192 Flinderation Road, Arlington Heights, Illinois',
62677], [5, 'Doug', '3236 Walkers Ridge Way, Burr Ridge', 61257],
] with open('customers.csv', 'wt') as f:
csv_writer = csv.writer(f, quoting=csv.QUOTE_NONNUMERIC)
csv_writer.writerow(header) # write header
csv_writer.writerows(rows)
Expected Output:
customers.csv
1 2 3 4 5 6
"id","name","address","zip" 1,"Hannah","4891 Blackwell Street, Anchorage, Alaska",99503 2,"Walton","4223 Half and Half Drive, Lemoore, California",97401 3,"Sam","3952 Little Street, Akron, Ohio",93704 4,"Chris","3192 Flinderation Road, Arlington Heights, Illinois",62677 5,"Doug","3236 Walkers Ridge Way, Burr Ridge",61257
Now all the names and addresses have double quotes around them.
If you want double quotes around all fields regardless of whether quotechar or delimiter appears in the data or not, set quoting to csv.QUOTE_ALL.
1 2 3 4 5
import csv header = ['id', 'name', 'address', 'zip'] rows = [
[1, 'Hannah', '4891 Blackwell Street, Anchorage, Alaska', 99503 ],
Page 14 of 25
6 7 8 9 10 11 12 13 14 15 16 17
[2, 'Walton', '4223 Half and Half Drive, Lemoore, California', 97401 ], [3, 'Sam', '3952 Little Street, Akron, Ohio', 93704], [4, 'Chris', '3192 Flinderation Road, Arlington Heights, Illinois',
62677], [5, 'Doug', '3236 Walkers Ridge Way, Burr Ridge', 61257],
] with open('customers.csv', 'wt') as f:
csv_writer = csv.writer(f, quoting=csv.QUOTE_ALL)
csv_writer.writerow(header) # write header
csv_writer.writerows(rows)
Expected Output:
1 2 3 4 5 6
"id","name","address","zip" "1","Hannah","4891 Blackwell Street, Anchorage, Alaska","99503" "2","Walton","4223 Half and Half Drive, Lemoore, California","97401" "3","Sam","3952 Little Street, Akron, Ohio","93704" "4","Chris","3192 Flinderation Road, Arlington Heights, Illinois","62677" "5","Doug","3236 Walkers Ridge Way, Burr Ridge","61257"
Everything is double-quoted now.
It is important to note that when quoting is on (i.e quoting parameter has a value other than csv.QUOTE_NONE), the csv module uses the quotechar (which defaults to ") to quote field.
The following listing changes the quote character from double quote (") to a single quote (').
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import csv header = ['id', 'name', 'address', 'zip'] rows = [
[1, 'Hannah', '4891 Blackwell Street, Anchorage, Alaska', 99503 ], [2, 'Walton', '4223 Half and Half Drive, Lemoore, California', 97401 ], [3, 'Sam', '3952 Little Street, Akron, Ohio', 93704], [4, 'Chris', '3192 Flinderation Road, Arlington Heights, Illinois',
62677], [5, 'Doug', '3236 Walkers Ridge Way, Burr Ridge', 61257],
] with open('customers.csv', 'wt') as f:
csv_writer = csv.writer(f, quotechar="'")
csv_writer.writerow(header) # write header
csv_writer.writerows(rows)
Expected Output:
1 id,name,address,zip
Page 15 of 25
2 3 4 5 6
1,Hannah,'4891 Blackwell Street, Anchorage, Alaska',99503 2,Walton,'4223 Half and Half Drive, Lemoore, California',97401 3,Sam,'3952 Little Street, Akron, Ohio',93704 4,Chris,'3192 Flinderation Road, Arlington Heights, Illinois',62677 5,Doug,'3236 Walkers Ridge Way, Burr Ridge',61257
In this case, the csv module uses the single quote (') instead of (") to quote fields containing quotechar or delimiter.
We can also turn off quoting all-together by setting quoting to csv.QUOTE_NONE. However, if you do that and delimiter character appears in the data then you will get an error like this:
VIDEO LINKS:
https://www.youtube.com/watch?v= JzkDsPBy8&feature=youtu.be
Page 16 of 25
DAY-5
1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17
import csv
header = ['id', 'name', 'address', 'zip'] rows = [
[1, 'Hannah', '4891 Blackwell Street, Anchorage, Alaska', 99503 ], [2, 'Walton', '4223 Half and Half Drive, Lemoore, California', 97401 ], [3, 'Sam', '3952 Little Street, Akron, Ohio', 93704], [4, 'Chris', '3192 Flinderation Road, Arlington Heights, Illinois',
62677], [5, 'Doug', '3236 Walkers Ridge Way, Burr Ridge', 61257],
]
with open('customers.csv', 'wt') as f: csv_writer = csv.writer(f, quoting=csv.QUOTE_NONE)
csv_writer.writerow(header) # write header
csv_writer.writerows(rows)
Expected Output:
1 2 3 4
Traceback (most recent call last): ... csv_writer.writerows(rows) _csv.Error: need to escape, but no escapechar set
The problem is that the address field contains embedded commas (,) and since we have turned off the ability to quote fields, the csv module doesn't know how to escape them properly.
This where the escapechar argument comes into play. It takes a one-character string that will be used to escape the delimiter when the the quoting is turned off (i.e quoting=csv.QUOTE_NONE).
The following listing set the escapechar to backslash (\).
1 2 3 4 5 6 7 8 9 10 11 12 13 14
import csv header = ['id', 'name', 'address', 'zip'] rows = [
[1, 'Hannah', '4891 Blackwell Street, Anchorage, Alaska', 99503 ], [2, 'Walton', '4223 Half and Half Drive, Lemoore, California', 97401 ], [3, 'Sam', '3952 Little Street, Akron, Ohio', 93704], [4, 'Chris', '3192 Flinderation Road, Arlington Heights, Illinois',
62677], [5, 'Doug', '3236 Walkers Ridge Way, Burr Ridge', 61257],
] with open('customers.csv', 'wt') as f:
csv_writer = csv.writer(f, quoting=csv.QUOTE_NONE, escapechar='\\')
Page 17 of 25
15 16 17
csv_writer.writerow(header) # write header
csv_writer.writerows(rows)
Expected Output:
1 2 3 4 5 6
id,name,address,zip 1,Hannah,4891 Blackwell Street\, Anchorage\, Alaska,99503 2,Walton,4223 Half and Half Drive\, Lemoore\, California,97401 3,Sam,3952 Little Street\, Akron\, Ohio,93704 4,Chris,3192 Flinderation Road\, Arlington Heights\, Illinois,62677 5,Doug,3236 Walkers Ridge Way\, Burr Ridge,61257
Notice that the commas (,) in the address field is escaped using the backslash (\) character.
You should now have a good understanding of various formatting arguments and the context in which they are used with the reader() and writer() function. In the next section will see some other ways to read and write data.
READING A CSV FILE WITH DictReader
DictReader works almost exactly like reader() but instead of retuning a line as a list, it returns a dictionary. Its syntax is as follows:
Syntax:: DictReader(fileobj, fieldnames=None, restkey=None, restval=None, dialect='excel', **fmtparam)
ARGUMENT DESCRIPTION
fileobj (required) It refers to the file object.
fieldnames (optional) It refers to the list of keys that will be used in the returned dictionary
in order. If omitted, the field names are inferred from the first row of the CSV
file.
restkey (optional) If the row has more fields than specified in the fieldnames parameter,
then the remaining fields is stored as a sequence keyed by the value
of restkey argument.
restval (optional) It provides value to fields which are missing from the input.
Page 18 of 25
ARGUMENT DESCRIPTION
dialect (optional) Dialect refers to the different ways of formatting the CSV document.
By default, the csv module uses the same format as Microsoft excel. We will
discuss dialect in detail later in this post.
fmtparam It refers to formatting arguments and works exactly like reader() and writer().
Let's take some examples:
Example 1:
customers.csv
1 2 3 4 5 6
id,name,address,zip 1,Hannah,4891 Blackwell Street\, Anchorage\, Alaska,99503 2,Walton,4223 Half and Half Drive\, Lemoore\, California,97401 3,Sam,3952 Little Street\, Akron\, Ohio,93704 4,Chris,3192 Flinderation Road\, Arlington Heights\, Illinois,62677 5,Doug,3236 Walkers Ridge Way\, Burr Ridge,61257
1 2 3 4 5 6 7
import csv with open('customers.csv', 'rt') as f:
csv_reader = csv.DictReader(f, escapechar='\\')
for row in csv_reader: print(row)
Expected Output:
1 2 3 4 5 6
{'id': '1', 'name': 'Hannah', 'zip': '99503', 'address': '4891 Blackwell Street, Anchorage, Alaska'} {'id': '2', 'name': 'Walton', 'zip': '97401', 'address': '4223 Half and Half Drive, Lemoore, California'} {'id': '3', 'name': 'Sam', 'zip': '93704', 'address': '3952 Little Street, Akron, Ohio'} {'id': '4', 'name': 'Chris', 'zip': '62677', 'address': '3192 Flinderation Road, Arlington Heights, Illinois'} {'id': '5', 'name': 'Doug', 'zip': '61257', 'address': '3236 Walkers Ridge Way, Burr Ridge'} **Note:** Order of keys in the result may vary. Since dictionary doesn't preserve the order of elements.
In this case, the field names are inferred from the first line (or header) of the CSV file.
Example 2: Using fieldnames parameter
Page 19 of 25
1 2 3 4 5
1,Hannah,4891 Blackwell Street\, Anchorage\, Alaska,99503 2,Walton,4223 Half and Half Drive\, Lemoore\, California,97401 3,Sam,3952 Little Street\, Akron\, Ohio,93704 4,Chris,3192 Flinderation Road\, Arlington Heights\, Illinois,62677 5,Doug,3236 Walkers Ridge Way\, Burr Ridge,61257
This CSV file has no header. So we have to provide field names via the fieldnames parameter.
1 2 3 4 5 6 7 8 9
import csv with open('customers.csv', 'rt') as f:
fields = ['id', 'name', 'address', 'zip']
csv_reader = csv.DictReader(f, fieldnames=fields, escapechar='\\')
for row in csv_reader: print(row)
Expected Output:
1 2 3 4 5
{'name': 'Hannah', 'zip': '99503', 'id': '1', 'address': '4891 Blackwell Street, Anchorage, Alaska'} {'name': 'Walton', 'zip': '97401', 'id': '2', 'address': '4223 Half and Half Drive, Lemoore, California'} {'name': 'Sam', 'zip': '93704', 'id': '3', 'address': '3952 Little Street, Akron, Ohio'} {'name': 'Chris', 'zip': '62677', 'id': '4', 'address': '3192 Flinderation Road, Arlington Heights, Illinois'} {'name': 'Doug', 'zip': '61257', 'id': '5', 'address': '3236 Walkers Ridge Way, Burr Ridge'}
Example 3: Using restkey parameter
1 2 3 4 5
1,Hannah,4891 Blackwell Street\, Anchorage\, Alaska,99503 2,Walton,4223 Half and Half Drive\, Lemoore\, California,97401 3,Sam,3952 Little Street\, Akron\, Ohio,93704 4,Chris,3192 Flinderation Road\, Arlington Heights\, Illinois,62677 5,Doug,3236 Walkers Ridge Way\, Burr Ridge,61257
1 2 3 4 5 6 7 8 9 10
import csv with open('customers.csv', 'rt') as f:
fields = ['id','name',]
csv_reader = csv.DictReader(f, fieldnames=fields, restkey='extra', escapechar='\\')
for row in csv_reader: print(row)
Expected Output:
Page 20 of 25
1 2 3 4 5
{'id': '1', 'name': 'Hannah', 'extra': ['4891 Blackwell Street, Anchorage, Alaska', '99503']} {'id': '2', 'name': 'Walton', 'extra': ['4223 Half and Half Drive, Lemoore, California', '97401']} {'id': '3', 'name': 'Sam', 'extra': ['3952 Little Street, Akron, Ohio', '93704']} {'id': '4', 'name': 'Chris', 'extra': ['3192 Flinderation Road, Arlington Heights, Illinois', '62677']} {'id': '5', 'name': 'Doug', 'extra': ['3236 Walkers Ridge Way, Burr Ridge', '61257']}
Notice that the address and zip code are now stored as a sequence keyed by value extra.
Example 4: Using restval
1 2 3 4 5
1,Hannah,4891 Blackwell Street\, Anchorage\, Alaska,99503 2,Walton,4223 Half and Half Drive\, Lemoore\, California,97401 3,Sam,3952 Little Street\, Akron\, Ohio,93704 4,Chris,3192 Flinderation Road\, Arlington Heights\, Illinois,62677 5,Doug,3236 Walkers Ridge Way\, Burr Ridge,61257
1 2 3 4 5 6 7 8 9 10
import csv with open('customers.csv', 'rt') as f:
fields = ['id','name', 'address', 'zip', 'phone', 'email'] # two extra fields
csv_reader = csv.DictReader(f, fieldnames=fields, restkey='extra', restval='NA', escapechar='\\')
for row in csv_reader: print(row)
Expected Output:
1 2 3 4 5
{'id': '1', 'name': 'Hannah', 'email': 'NA', 'phone': 'NA', 'address': '4891 Blackwell Street, Anchorage, Alaska', 'zip': '99503'} {'id': '2', 'name': 'Walton', 'email': 'NA', 'phone': 'NA', 'address': '4223 Half and Half Drive, Lemoore, California', 'zip': '97401'} {'id': '3', 'name': 'Sam', 'email': 'NA', 'phone': 'NA', 'address': '3952 Little Street, Akron, Ohio', 'zip': '93704'} {'id': '4', 'name': 'Chris', 'email': 'NA', 'phone': 'NA', 'address': '3192 Flinderation Road, Arlington Heights, Illinois', 'zip': '62677'} {'id': '5', 'name': 'Doug', 'email': 'NA', 'phone': 'NA', 'address': '3236 Walkers Ridge Way, Burr Ridge', 'zip': '61257'}
In this case, we have specified field two extra fields: phone and email. The values for extra fields is provided by the restval argument.
Page 21 of 25
Writing CSV files with DictWriter()
The DictWriter object writes a dictionary to a CSV file. Its syntax is as follows:
Syntax: DictWriter(fileobj, fieldnames, restval='', extrasaction='raise', dialect='excel', **fmtparam)
Argument Description
fileobj It refers to the file object
fieldnames It refers to the field names and the order in which they will be written the file.
restval It provides the missing value for the keys which doesn't exist in the dictionary.
extrasaction It controls what action to take if the dictionary contains a key, that is not found in
the fieldnames argument. By default, extrasaction is set to raise, which means an
exception will be raised in such an event. If you want to ignore the extra values
set extrasaction to ignore.
The DictWriter provides the following three methods to write data.
Method Description
writeheader() Writes the header (i.e fieldnames) to the CSV file and returns None.
writerow(row) Writes a single row of data and returns the number of characters written.
The row must be a sequence of strings and number.
writerows(rows) Writes multiple rows of data and returns None. The rows must be a sequence.
Let's take some examples:
Example 1:
import csv
Page 22 of 25
header = ['id', 'name', 'address', 'zip']
rows = [
{'id': 1, 'name': 'Hannah', 'address': '4891 Blackwell Street, Anchorage, Alaska', 'zip': 99503 },
{'id': 2, 'name': 'Walton', 'address': '4223 Half and Half Drive, Lemoore, California', 'zip': 97401 },
{'id': 3, 'name': 'Sam', 'address': '3952 Little Street, Akron, Ohio', 'zip': 93704 },
{'id': 4, 'name': 'Chris', 'address': '3192 Flinderation Road, Arlington Heights, Illinois', 'zip': 62677},
{'id': 5, 'name': 'Doug', 'address': '3236 Walkers Ridge Way, Burr Ridge', 'zip': 61257},
]
with open('dictcustomers.csv', 'wt') as f:
csv_writer = csv.DictWriter(f, fieldnames=header)
csv_writer.writeheader() # write header
csv_writer.writerows(rows)
Expected Output:
dictcustomers.csv
1 2 3 4 5 6
id,name,address,zip 1,Hannah,"4891 Blackwell Street, Anchorage, Alaska",99503 2,Walton,"4223 Half and Half Drive, Lemoore, California",97401 3,Sam,"3952 Little Street, Akron, Ohio",93704 4,Chris,"3192 Flinderation Road, Arlington Heights, Illinois",62677 5,Doug,"3236 Walkers Ridge Way, Burr Ridge",61257
Example 2: Using restval
1 2 import csv
Page 23 of 25
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
header = ['id', 'name', 'address', 'zip', 'email'] # an extra field email rows = [
{'id': 1, 'name': 'Hannah', 'address': '4891 Blackwell Street, Anchorage, Alaska', 'zip': 99503 },
{'id': 2, 'name': 'Walton', 'address': '4223 Half and Half Drive, Lemoore, California', 'zip': 97401 },
{'id': 3, 'name': 'Sam', 'address': '3952 Little Street, Akron, Ohio', 'zip': 93704 },
{'id': 4, 'name': 'Chris', 'address': '3192 Flinderation Road, Arlington Heights, Illinois', 'zip': 62677},
{'id': 5, 'name': 'Doug', 'address': '3236 Walkers Ridge Way, Burr Ridge', 'zip': 61257}, ] with open('dictcustomers.csv', 'wt') as f:
csv_writer = csv.DictWriter(f, fieldnames=header, restval="NA")
csv_writer.writeheader() # write header
csv_writer.writerows(rows)
Expected Output:
dictcustomers.csv
1 2 3 4 5 6
id,name,address,zip,email 1,Hannah,"4891 Blackwell Street, Anchorage, Alaska",99503,NA 2,Walton,"4223 Half and Half Drive, Lemoore, California",97401,NA 3,Sam,"3952 Little Street, Akron, Ohio",93704,NA 4,Chris,"3192 Flinderation Road, Arlington Heights, Illinois",62677,NA 5,Doug,"3236 Walkers Ridge Way, Burr Ridge",61257,NA
In this case, the value of email field is missing from the dictionaries. As s result, the value of restval will be used for the email field.
Example 3: Using extrasaction
1 2 3 4 5 6 7 8 9 10 11
import csv header = ['id', 'name', 'address'] # notice zip is missing rows = [
{'id': 1, 'name': 'Hannah', 'address': '4891 Blackwell Street, Anchorage, Alaska', 'zip': 99503 },
{'id': 2, 'name': 'Walton', 'address': '4223 Half and Half Drive, Lemoore, California', 'zip': 97401 },
{'id': 3, 'name': 'Sam', 'address': '3952 Little Street, Akron, Ohio', 'zip': 93704 },
Page 24 of 25
12 13 14 15 16 17 18 19 20 21 22 23 24
{'id': 4, 'name': 'Chris', 'address': '3192 Flinderation Road, Arlington Heights, Illinois', 'zip': 62677},
{'id': 5, 'name': 'Doug', 'address': '3236 Walkers Ridge Way, Burr Ridge', 'zip': 61257}, ]
with open('dictcustomers.csv', 'wt') as f:
csv_writer = csv.DictWriter( f, fieldnames=header, restval="NA", extrasaction='ignore' # ignore extra values in the
dictionary )
csv_writer.writeheader() # write header
csv_writer.writerows(rows)
Here, the dictionary contains an extra key named zip which is not present in the header list. To prevent the exception from being raised we have set extrasaction to ignore.
Expected Output:
dictcustomers.csv
1 2 3 4 5 6
id,name,address 1,Hannah,"4891 Blackwell Street, Anchorage, Alaska" 2,Walton,"4223 Half and Half Drive, Lemoore, California" 3,Sam,"3952 Little Street, Akron, Ohio" 4,Chris,"3192 Flinderation Road, Arlington Heights, Illinois" 5,Doug,"3236 Walkers Ridge Way, Burr Ridge"
VIDEO LINKS:
https://www.youtube.com/watch?v= JzkDsPBy8&feature=youtu.be