Detailed visualisation and data analysis of occupancy patterns including spatial distribution and temporal variations are of great importance to delivering energy efficient and productive buildings. An experimental study comprising 24-h monitoring over 30 full days was conducted in a university library building. Occupancy profiles have been monitored and analysis has been carried out. Central to this monitoring study is the Wi-Fi based indoor positioning system based on the measured Wi-Fi devices' number and locations and data mining methods. Distinct from traditional occupancy and energy studies, more detailed information related to the indoor positions and number of occupants has offered a better understanding of building user behaviour. The implication of the occupancy patterns for energy (e.g. lighting and other building services) efficiency is assessed, assisted with data from lighting sensors where needed. It is found occupancy patterns change dramatically with time. Also, the energy waste patterns have been identified through the method of data association rule mining. If the identified energy waste is removed, the total energy consumption can be reduced by 26.1%. The indoor positioning information also has implications for optimizing space use, opening hours as well as staff deployment. The work could be extended to more rooms with diverse functions, other seasons and other types of non-domestic buildings for a more comprehensive understanding of building user behaviour and energy efficiency.